walletInFlightSwapsReadProvider top-level property

FutureProviderFamily<List<SwapRecord>, Object?> walletInFlightSwapsReadProvider
final

The durable IN-FLIGHT SWAPS surface (W-swap-5, #366) — every swap whose order was registered at execute and has neither been dismissed nor self-lapsed. THE kill→relaunch re-attach: after a process restart the wallet screen lists these and "view swap" re-opens live tracking by the record's id — without this, an armed OutOfZec deposit was invisible everywhere while the one-swap-in-flight guard refused new swaps (the hardware photo). Invalidated on the SAME edges as the send surfaces (the _WalletActive sync listener + resume) AND on a swap execute landing / a record dismiss. Returns EMPTY when no session exists. Like the PARKED surface, a read failure PROPAGATES to AsyncError: mid-flight this list is the ONLY wallet-side witness of the swap (an OutOfZec deposit is excluded from the parked/in-flight send surfaces by design; an IntoZec swap has no activity trace until delivery), so the surface shows an honest "couldn't load" rather than a silent hide. Deliberately NOT gated on swapEnabledProvider: a local read is not swap traffic (§3.5) — the user keeps sight of money in motion even with swap disabled or killed. §5.4: the record id is render-never-log. RETRY PINNED OFF: same shape and CORRECTED rationale as walletParkedSendsReadProvider — the section's skipLoadingOnReload already surfaced the error arm on the first failure; the pin kills the wasted background retry cycling behind it and settles the state, at the cost of the error line standing until the shared sync-edge/resume/dismiss invalidation cadence (this reader's own retry) next fires. The identity-scoped READER behind walletInFlightSwapsProvider — invalidate THIS; watch the view.

Implementation

final walletInFlightSwapsReadProvider = FutureProvider.autoDispose
    .family<List<SwapRecord>, Object?>((ref, identity) {
      // Dying-element guard — see walletSnapshotReadProvider.
      final superseded = ref.watch(walletIdentityProvider) != identity;
      final session = ref.watch(walletSessionProvider);
      if (superseded || session == null) {
        return Future<List<SwapRecord>>.value(const <SwapRecord>[]);
      }
      return session.listInFlightSwaps();
    }, retry: walletNoSilentRetry);