getCurrentSessionId method
Get the current session ID
Implementation
String getCurrentSessionId() {
if (_currentSession != null) {
return _currentSession!.sessionId;
} else {
// No current session, create one synchronously
final newSessionId = _generateSessionId();
final now = _getCurrentTimeMs();
_currentSession = SessionData(
sessionId: newSessionId,
createdAt: now,
lastActiveAt: now,
appStartTime: now,
rotationReason: RotationReason.appStart.description,
);
// Store asynchronously in background
_storeCurrentSession();
_notifySessionRotated(null, newSessionId, RotationReason.appStart);
Logger.i(
'🔄 Session created synchronously: $newSessionId (${RotationReason.appStart.description})');
return newSessionId;
}
}