init method
Implementation
ArgosManager init({
ArgosConfig? config,
Function(ArgosBaseModel?)? listener,
}) {
final isFirstInit = !_initialized;
final effectiveConfig = config ?? ArgosConfig();
this.config = effectiveConfig;
this.listener = listener;
_initialized = true;
final storage = ArgosPacketStorage.instance;
storage.onCleared = _handleStorageCleared;
storage.persistInterval = effectiveConfig.storagePersistInterval;
storage.setAdapter(effectiveConfig.storageAdapter);
// Queue recovery before an automatic begin. Neither operation needs to
// block the synchronous public init API.
unawaited(storage.hydrate());
_registerLifecycleObserver();
if (isFirstInit &&
_activeSession == null &&
effectiveConfig.sessionMode == ArgosSessionMode.automatic &&
effectiveConfig.enableStorage) {
_startNewSession(
now: _now(),
automaticManaged: true,
automaticPolicy: effectiveConfig.automaticSessionPolicy,
);
}
initializeMonitors();
return this;
}