LittlefishSessionManager class
Note: Session tokens refreshes are still needed but the token expiration is now extended to basically be a lifetime token.
Constructors
- LittlefishSessionManager()
-
factory
Properties
- activeSession → AuthUserSession?
-
no setter
- analyticsService → AnalyticsService
-
no setter
- authService → AuthService
-
no setter
- configService → ConfigService
-
no setter
- core ↔ LittleFishCore
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- logger → LoggerService
-
no setter
-
monitoringService
→ MonitoringService<
dynamic, MonitoringHttpMetric, MonitoringTrace> -
no setter
-
onSessionChanged
→ Stream<
AuthUserSession?> -
listens to active session changes
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionService → AuthSessionService
-
no setter
- tokenHelper → TokenHelper
-
no setter
Methods
-
createSession(
String userId, {String? mid}) → Future< AuthUserSession> - Creates a new session via the service and stores it in memory.
-
deleteAllSessions(
{required String businessId, String? mid}) → Future< void> - Deletes all sessions from the server and clears them from memory.
-
deleteSession(
String userId) → Future< void> - Deletes a single user's session from the server and memory.
-
getActiveSession(
) → Future< AuthUserSession?> - Retrieves the currently active session, or null if no valid session exists.
-
getOrCreateSession(
{required String userId, String? mid, String? businessId, bool refresh = false}) → Future< AuthUserSession> - Retrieves a session from memory, or fetches/creates it from the server.
-
getSessionByUserId(
String userId, {bool force = false}) → Future< AuthUserSession?> -
Retrieves a session by
userId, optionally forcing a fetch from the server. -
getSessionStatus(
AuthUserSession session) → AuthSessionStatus -
initialise(
) → Future< void> -
isSessionExpired(
AuthUserSession session) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshCurrentSession(
) → Future< AuthUserSession> - Deprecated Tries to refresh the currently active session. If no active session exists, throws an error.
-
refreshSession(
String userId) → Future< AuthUserSession> -
Deprecated
Refreshes the session for the given
userIdby fetching a new session from the server. -
refreshSessionIfExpiring(
AuthUserSession existingSession) → Future< AuthUserSession> - Deprecated Refreshes the session if it is expiring soon or expired. Returns the valid session (refreshed or existing).
-
switchSession(
{required String userId, String? mid, String? businessId, bool refresh = false}) → Future< AuthUserSession> -
Switches the activeSession to the one associated with
userIdand optionally with themidandbusinessId. -
toString(
) → String -
A string representation of this object.
inherited
-
validateSession(
AuthUserSession? session, {bool refreshOnExpiring = true}) → Future< void> - Validates that the session is valid.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → LittlefishSessionManager
-
final