setActiveSession method
Sets the currently active session and persists the ID.
Implementation
Future<void> setActiveSession(AuthUserSession? session) async {
_activeSession = session;
_sessionController.add(_activeSession);
if (session != null && session.userId.isNotEmpty) {
await _storage?.write(
key: _activeSessionUserIdKey,
value: session.userId,
);
} else {
logger.warning(
this,
'Provided session unavailable while setting active session.',
);
await _storage?.delete(key: _activeSessionUserIdKey);
}
}