syncDown method

Future<void> syncDown()

Downloads the avatar and restores embedded preferences if present.

Implementation

Future<void> syncDown() async {
  final userDto = await _authRepository.refreshLogin();
  final filename = userDto.avatarFilename;
  if (filename == null || filename.isEmpty) return;

  final avatarBytes = await _portalService.getAvatar(filename);

  final (:jpeg, :version, :data) = decodeAvatarPayload(avatarBytes);
  if (data == null || version != 0x00) return;

  await _fromMap(data);
}