Skip to content

Commit

Permalink
Make name field of _UserInfo nullable. Fix #3424 (#3442)
Browse files Browse the repository at this point in the history
  • Loading branch information
talisk authored May 31, 2022
1 parent 6f20a94 commit 6c63504
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/command/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LoginCommand extends PubCommand {
final userInfo = json.decode(userInfoRequest.body);
final name = userInfo['name'];
final email = userInfo['email'];
if (name is String && email is String) {
if (email is String) {
return _UserInfo(name, email);
} else {
log.fine(
Expand All @@ -72,9 +72,9 @@ class LoginCommand extends PubCommand {
}

class _UserInfo {
final String name;
final String? name;
final String email;
_UserInfo(this.name, this.email);
@override
String toString() => ['<$email>', name].join(' ');
String toString() => ['<$email>', name ?? ''].join(' ');
}

0 comments on commit 6c63504

Please sign in to comment.