useAppLifecycleState function

ReadonlySignal<AppLifecycleState?> useAppLifecycleState({
  1. AppLifecycleState? initialState,
  2. void onChange(
    1. AppLifecycleState state
    )?,
})

Listens to application lifecycle state changes

Returns a reactive Signal representing the current application lifecycle state

Implementation

ReadonlySignal<AppLifecycleState?> useAppLifecycleState({
  AppLifecycleState? initialState,
  void Function(AppLifecycleState state)? onChange,
}) {
  final observer = useHook(
      _AppLifecycleObserver(initialState: initialState, onChange: onChange));

  return observer.readonly();
}