


# AccountModel.fromFirebaseUser constructor




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



AccountModel.fromFirebaseUser([User](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/User-class.html)? user, {[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? accessToken})





## Implementation

```dart
factory AccountModel.fromFirebaseUser(User? user, {String? accessToken}) {
  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: false,
      email: user.email,
      phoneNumber: user.phoneNumber,
      photoURL: user.photoURL,
      accessToken: accessToken,
    );
  } else {
    throw ModelParsingFailureFirebase('null-user', 'User cannot be null');
  }
}
```







