updateProfile method

  1. @override
Future<AuthResult<UserModel>> updateProfile({
  1. String? displayName,
  2. String? photoUrl,
})
override

Implementation

@override
Future<AuthResult<UserModel>> updateProfile({String? displayName, String? photoUrl}) async {
  try {
    final user = _auth.currentUser;
    if (user == null) {
      return const AuthResult.failure(AuthException('No authenticated user'));
    }
    await user.updateDisplayName(displayName);
    await user.updatePhotoURL(photoUrl);
    await user.reload();
    return AuthResult.success(_mapFirebaseUser(_auth.currentUser!));
  } on fb.FirebaseAuthException catch (e) {
    return AuthResult.failure(AuthException.fromFirebase(e));
  }
}