syncStatusProvider top-level property
The live, lifecycle-gated sync status (spec §3.3; flutter-patterns
§ Stream Lifecycle; the contract in core/lifecycle/app_lifecycle_provider).
Two ORTHOGONAL recovery mechanisms, exactly as the contract demands:
- Lifecycle gate — cancel the Rust-side stream on
paused(battery), re-snapshot + re-subscribe ONLY on a realpaused → resumed(tracked locally;inactive/hidden → resumedis window-focus / shade noise, not a real resume). Never pause onhidden(desktop's deepest state; Android's pre-pausedstep) — desktop keeps the stream live while hidden, which is wanted. - Reconnect-on-fault — a stream error or completion (transport drop,
EOF, timeout — the unstable-network normal) re-subscribes with
capped exponential backoff, INDEPENDENT of lifecycle. On desktop
pausednever fires, so this is the ONLY recovery path there.
Implementation
final syncStatusProvider =
NotifierProvider<SyncStatusNotifier, AsyncValue<SyncStatus>>(
SyncStatusNotifier.new,
);