getSessionAnalytics method

Map<String, dynamic> getSessionAnalytics()

Gets session analytics

Implementation

Map<String, dynamic> getSessionAnalytics() {
  final totalSessions = _activeSessions.length;
  final activeSessions = _activeSessions.values
      .where((session) => !session.isExpired)
      .length;
  final expiredSessions = totalSessions - activeSessions;

  return {
    'totalSessions': totalSessions,
    'activeSessions': activeSessions,
    'expiredSessions': expiredSessions,
    'lastCleanup': DateTime.now().toIso8601String(),
  };
}