Skip to content

Commit

Permalink
fix(firebase_auth): Check if UserMetadata properties are null bef…
Browse files Browse the repository at this point in the history
…ore parsing. (#8313)
  • Loading branch information
Ehesp committed Mar 22, 2022
1 parent 2504227 commit cac41fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Expand Up @@ -25,13 +25,17 @@ class UserWeb extends UserPlatform {
'email': _webUser.email,
'emailVerified': _webUser.emailVerified,
'isAnonymous': _webUser.isAnonymous,
'metadata': <String, int>{
'creationTime': _dateFormat
.parse(_webUser.metadata.creationTime)
.millisecondsSinceEpoch,
'lastSignInTime': _dateFormat
.parse(_webUser.metadata.lastSignInTime)
.millisecondsSinceEpoch,
'metadata': <String, int?>{
'creationTime': _webUser.metadata.creationTime != null
? _dateFormat
.parse(_webUser.metadata.creationTime!)
.millisecondsSinceEpoch
: null,
'lastSignInTime': _webUser.metadata.lastSignInTime != null
? _dateFormat
.parse(_webUser.metadata.lastSignInTime!)
.millisecondsSinceEpoch
: null,
},
'phoneNumber': _webUser.phoneNumber,
'photoURL': _webUser.photoURL,
Expand Down
Expand Up @@ -344,11 +344,11 @@ abstract class ActionCodeInfo {
abstract class UserMetadata {
/// The date the user was created, formatted as a UTC string.
/// For example, 'Fri, 22 Sep 2017 01:49:58 GMT'.
external String get creationTime;
external String? get creationTime;

/// The date the user last signed in, formatted as a UTC string.
/// For example, 'Fri, 22 Sep 2017 01:49:58 GMT'.
external String get lastSignInTime;
external String? get lastSignInTime;
}

/// A structure for [User]'s user profile.
Expand Down

0 comments on commit cac41fb

Please sign in to comment.