SessionManager class

Manages session IDs with time-based rotation strategy

Strategy 1: Time-Based Rotation

  • Rotates every 30-60 minutes of active use
  • Rotates on app restart/cold start
  • Rotates when app returns from background after >15 minutes
  • Rotates on user authentication changes

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(SessionRotationListener listener) → void
Add a session rotation listener
forceRotation() Future<String>
Manually force session rotation
getCurrentSession() SessionData?
Get current session data
getCurrentSessionId() String
Get the current session ID
getSessionStats() Map<String, dynamic>
Get session statistics
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAppBackground() Future<void>
Handle app going to background
onAppForeground() Future<void>
Handle app coming to foreground
onAuthenticationChange(String? userId) Future<void>
Handle user authentication changes
onNetworkChange() Future<void>
Handle network connectivity changes
removeListener(SessionRotationListener listener) → void
Remove a session rotation listener
toString() String
A string representation of this object.
inherited
updateActivity() Future<void>
Update session activity (call this on user interactions)

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getInstance() SessionManager?
Get the current SessionManager instance
initialize({SessionConfig config = const SessionConfig()}) Future<CFResult<SessionManager>>
Initialize the SessionManager singleton
shutdown() → void
Shutdown the SessionManager