Skip to content

Commit befc0a1

Browse files
authored
(pub login) Allow userinfo to not contain a name (#4635)
1 parent 4f634ed commit befc0a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/src/command/login.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ class LoginCommand extends PubCommand {
6464
try {
6565
switch (json.decode(userInfoRequest.body)) {
6666
case {'name': final String? name, 'email': final String email}:
67-
return _UserInfo(name, email);
67+
return _UserInfo(name: name, email: email);
68+
case {'email': final String email}:
69+
return _UserInfo(name: null, email: email);
6870
default:
6971
log.fine(
7072
'Bad response from $userInfoEndpoint: ${userInfoRequest.body}',
@@ -84,7 +86,7 @@ class LoginCommand extends PubCommand {
8486
class _UserInfo {
8587
final String? name;
8688
final String email;
87-
_UserInfo(this.name, this.email);
89+
_UserInfo({required this.name, required this.email});
8890
@override
8991
String toString() => ['<$email>', name ?? ''].join(' ');
9092
}

0 commit comments

Comments
 (0)