SessionManager class
The SessionManager keeps track of and manages the signed-in state of the user. Use the instance method to get access to the singleton instance. Users are typically authenticated with Google, Apple, or other methods. Please refer to the documentation to see supported methods. Session information is stored in the shared preferences of the app and persists between restarts of the app.
- Mixed in types
Constructors
- SessionManager({required Caller caller, Storage? storage})
- Creates a new session manager.
Properties
- caller ↔ Caller
-
The auth module's caller.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isSignedIn → bool
-
Returns true if the user is currently signed in.
no setter
- keyManager ↔ FlutterAuthenticationKeyManager
-
The key manager, holding the key's of the user, if signed in.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signedInUser ↔ UserInfo?
-
Returns information about the signed in user or null if no user is
currently signed in.
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
initialize(
) → Future< bool> - Initializes the session manager by reading the current state from shared preferences. The returned bool is true if the session was initialized, or false if the server could not be reached.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
refreshSession(
) → Future< bool> - Verify the current sign in status with the server and update the UserInfo. Returns true if successful.
-
registerSignedInUser(
UserInfo userInfo, int authenticationKeyId, String authenticationKey) → Future< void> - Registers the signed in user, updates the keyManager, and upgrades the streaming connection if it is open.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
signOut(
) → Future< bool> - Signs the user out from all connected devices. Returns true if successful.
-
toString(
) → String -
A string representation of this object.
inherited
-
uploadUserImage(
ByteData image) → Future< bool> - Uploads a new user image if the user is signed in. Returns true if upload was successful.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
instance
→ Future<
SessionManager> -
Returns a singleton instance of the session manager
no setter