onLifecycleEvent method
void Function()
onLifecycleEvent(
- void handler(
- SessionLifecycleEvent event
- SessionLifecycleEventType? type
Subscribe to all session lifecycle events. Returns an unsubscribe fn.
Implementation
void Function() onLifecycleEvent(
void Function(SessionLifecycleEvent event) handler, [
SessionLifecycleEventType? type,
]) {
if (type != null) {
final list = _typedLifecycleHandlers.putIfAbsent(type, () => []);
list.add(handler);
return () => list.remove(handler);
}
_lifecycleHandlers.add(handler);
return () => _lifecycleHandlers.remove(handler);
}