uploadPhoto method
Updates only the profile photo
Implementation
Future<void> uploadPhoto(List<int> photoBytes) async {
if (state.profile == null) return;
emit(state.copyWith(isLoading: true, error: null));
final result = await updateProfilePhoto(photoBytes);
result.fold(
(failure) => emit(state.copyWith(
isLoading: false,
error: failure.message,
)),
(_) {
final updatedProfile = state.profile!.copyWith(
personalPhotoBytes: photoBytes,
);
emit(state.copyWith(
profile: updatedProfile,
isLoading: false,
error: null,
));
},
);
}