


# AccountModel.fromFirebaseUserCredential constructor




    *[<Null safety>](https://dart.dev/null-safety)*



AccountModel.fromFirebaseUserCredential([UserCredential](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/UserCredential-class.html)? userCredential)





## Implementation

```dart
factory AccountModel.fromFirebaseUserCredential(
  UserCredential? userCredential,
) {
  final user = userCredential?.user;
  if (user != null) {
    final providerId =
        (user.providerData.isEmpty) ? '' : user.providerData.first.providerId;
    return AccountModel._(
      user: user,
      id: user.uid,
      emailVerified: user.emailVerified,
      isAnonymous: user.isAnonymous,
      providerId: providerId,
      creationTime: user.metadata.creationTime,
      lastSignInTime: user.metadata.lastSignInTime,
      isNewUser: userCredential?.additionalUserInfo?.isNewUser,
      email: user.email,
      phoneNumber: user.phoneNumber,
      photoURL: user.photoURL,
      accessToken: userCredential?.credential?.accessToken,
    );
  } else {
    throw ModelParsingFailureFirebase('null-user', 'User cannot be null');
  }
}
```







