AppLifecycleNotifier class

THE app-lifecycle seam (app-frame spec §3).

STANDING RULE (review gate, flutter-patterns § Stream Lifecycle): every future FRB stream provider MUST watch this provider and

  • pause its Rust-side stream on AppLifecycleState.paused,
  • resume AND re-fetch latest state on AppLifecycleState.resumed ONLY when resuming from an actual pause (track "was paused" locally; changes during the pause are otherwise silently missed). inactive → resumed fires on every desktop window-focus change and every mobile notification-shade pull — re-fetching there is wasted network/battery, not correctness. Desktop (spec §9): paused never fires on macOS/Linux/Windows — the deepest state is hidden and a minimized app keeps running, so streams stay live while hidden. That is the WANTED desktop behavior; do not "fix" it by pausing on hidden. (hidden is NOT desktop-only: Android fires it as an intermediate state before paused during normal backgrounding — the rule holds on both platforms.) ORTHOGONAL RULE — connection loss is not a lifecycle event: a stream that dies mid-foreground (transport error, EOF, timeout) gets no paused and, on desktop, no lifecycle transition at all. Every FRB stream provider must ALSO treat stream error/completion as a reconnect trigger, independent of this seam. Without this: battery drain, app killed by the OS, broken UX. The frame ships the seam so the first FFI consumer has no reason to hand-roll its own observer.
Implementers

Constructors

AppLifecycleNotifier()

Properties

hashCode → int
The hash code for this object.
no setterinherited
ref → Ref
The Ref associated with this notifier.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state ↔ AppLifecycleState
The value currently exposed by this notifier.
getter/setter pairinherited
stateOrNull → AppLifecycleState?
The value currently exposed by this Notifier.
no setterinherited

Methods

build() → AppLifecycleState
Initialize a Notifier.
listenSelf(void listener(AppLifecycleState? previous, AppLifecycleState next), {void onError(Object error, StackTrace stackTrace)?}) → RemoveListener
Listens to changes on the value exposed by this provider.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runBuild() → WhenComplete?
Executes Notifier.build.
inherited
toString() → String
A string representation of this object.
inherited
updateShouldNotify(AppLifecycleState previous, AppLifecycleState next) → bool
A method invoked when the state exposed by this Notifier changes. It compares the previous and new value, and return whether listeners should be notified.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited