AppSessionTracker constructor
AppSessionTracker({
- Duration sessionTimeout = const Duration(minutes: 30),
- RoyLifecycleCoordinator? lifecycle,
- String generateSessionId()?,
- Stopwatch createStopwatch()?,
Implementation
AppSessionTracker({
this.sessionTimeout = const Duration(minutes: 30),
RoyLifecycleCoordinator? lifecycle,
String Function()? generateSessionId,
Stopwatch Function()? createStopwatch,
}) : _generateSessionId = generateSessionId ?? _defaultSessionId,
_createStopwatch = createStopwatch ?? Stopwatch.new {
_foregroundStopwatch = _createStopwatch();
_startNewSession();
final coordinator = lifecycle ?? RoyLifecycleCoordinator.maybe;
if (coordinator != null) {
_lifecycle = coordinator;
coordinator.registerHook(_hookName, (event) async {
handleLifecycleEvent(event);
});
}
}