Skip to content

Commit 4ca9feb

Browse files
authored
fix: rolled back to null aware op when checking currentSession. docs: kept the currentUser comments simple
1 parent e69b9be commit 4ca9feb

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/gotrue/lib/src/gotrue_client.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,7 @@ class GoTrueClient {
134134
/// Getter for the headers
135135
Map<String, String> get headers => _headers;
136136

137-
/// Returns the current logged in user, if any;
138-
///
139-
/// Use [currentSession] to determine whether the user has an active session,
140-
/// because [currentUser] can be null with an active session, such as
141-
/// when the user signed up using email and password but has not confirmed
142-
/// their email address.
137+
/// Returns the current logged in user, asociated to [currentSession] if any;
143138
User? get currentUser => _currentSession?.user;
144139

145140
/// Returns the current session, if any;
@@ -745,7 +740,7 @@ class GoTrueClient {
745740
options: options);
746741
final userResponse = UserResponse.fromJson(response);
747742

748-
_currentSession = currentSession!.copyWith(user: userResponse.user);
743+
_currentSession = currentSession?.copyWith(user: userResponse.user);
749744
notifyAllSubscribers(AuthChangeEvent.userUpdated);
750745

751746
return userResponse;

0 commit comments

Comments
 (0)