updateProfile method
- UserProfile profile
Updates the entire user profile
Implementation
Future<void> updateProfile(UserProfile profile) async {
emit(state.copyWith(isLoading: true, error: null));
final result = await saveUserProfile(profile);
result.fold(
(failure) => emit(state.copyWith(
isLoading: false,
error: failure.message,
)),
(_) => emit(state.copyWith(
profile: profile,
isLoading: false,
isEditing: false,
error: null,
)),
);
}