SwapController class

Constructors

SwapController()

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 ↔ SwapFlowState
The value currently exposed by this notifier.
getter/setter pairinherited
stateOrNull → SwapFlowState?
The value currently exposed by this Notifier.
no setterinherited

Methods

attachTo({required String swapId, required SwapFlowDirection direction}) → void
RE-ATTACH to a live swap by its durable record (W-swap-5, #366): the wallet screen's in-flight row / the guard-fault "view swap" hand the persisted id + coarse direction here, then push the swap screen — the tracking view re-opens the live status stream by id. A NO-OP while a transient step runs (defensive: never clobber an in-flight quote/execute), while the SAME swap is already attached (idempotent tap), and while ANY live SwapAwaitingDeposit holds the screen (crypto-review H2 + arch review H-A1, both probe-confirmed): its quote carries the IntoZec deposit address/amount/memo, which are deliberately NOT persisted, so replacing it with a bare SwapExecuted — same id OR a different row's — would one-tap-destroy the only copy of active payment instructions. The RICHER state always wins, unconditionally; the deposit screen's own markDepositSent (or its explicit leave) is the exit. The tapped OTHER swap stays one tap away in the home list once the deposit screen is done.
backToForm() → void
Return to the form from review (the Back / Edit action). A no-op mid-flight (a transient state) so a stray tap can't abandon an in-flight quote/execute.
build() → SwapFlowState
Initialize a Notifier.
execute() → Future<void>
Execute the reviewed quote — claim the durable single-flight (by id), register the swap intent, and (OutOfZec only) queue the §4.4 ZEC deposit. On success: OutOfZec → SwapExecuted (the wallet sent the deposit; track it); IntoZec → SwapAwaitingDeposit (the D7 "send your funds" screen — the USER deposits externally, §3.3b L7). Every TYPED failure routes back to the FORM with a re-quote fault: the core claims the single-flight FIRST, so a failed execute may have consumed the quote — re-executing would be QuoteExpired (#367); re-quoting is the only safe path (never a double-deposit). The ONE exception is an OutOfZec TIMEOUT (W-swap-4-a-2): a .timeout abandons — not cancels — the Rust future, so the deposit may be signing/in motion; that arm goes to TRACKING by quote id, never to a re-quotable form (a timeout is not a failure). The SDK's SwapAlreadyInFlight guard backstops any host that re-quotes anyway.
listenSelf(void listener(SwapFlowState? previous, SwapFlowState next), {void onError(Object error, StackTrace stackTrace)?}) → RemoveListener
Listens to changes on the value exposed by this provider.
inherited
markDepositSent() → void
IntoZec only: the user tapped "I've sent the funds" on the D7 deposit screen — advance to SwapExecuted live tracking (the swap was already registered at execute; this is purely a UX hand-off, it sends nothing). A no-op from any other state so a stray late callback can't derail the flow.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
quote(SwapFormInput input) → Future<void>
Request a bounds-checked quote (§2.6) for either direction. Dispatches on the sealed SwapFormInput so each shape carries only its own fields. On success → SwapReview with the confirmable numbers + the §2.6 disclosure; on a typed failure → back to SwapFormState with an honest inline fault. Funds NEVER move here — quote is deterministic and side-effect-free.
resetToForm() → void
Reset to a clean form — called on screen entry so a stale quote (or a terminal fault) never lingers into a new swap. A NO-OP while a step is in flight (review F1) AND — since W-swap-5 (#366) — while a COMMITTED swap is live (SwapExecuted / SwapAwaitingDeposit): re-entering the screen RE-ATTACHES to the running flow instead of wiping the one surface tracking money in motion (pre-#366 tracking was one-shot — leaving the screen orphaned a live swap with no way back). Leaving a live swap is explicit: the terminal card's Done calls startNewSwap.
runBuild() → WhenComplete?
Executes Notifier.build.
inherited
startNewSwap() → void
Explicitly leave a live swap's tracking for a clean form (W-swap-5) — the terminal card's Done (the swap is over; the status stream's terminal observation already dismissed the durable record) or a deliberate "start another swap". Still refuses mid-transient (a stray tap must not abandon an in-flight quote/execute — backToForm's guard).
toString() → String
A string representation of this object.
inherited
updateShouldNotify(SwapFlowState previous, SwapFlowState 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