resetToForm method

void resetToForm({
  1. bool requestRevoked = false,
})

Reset to a clean form — called on screen entry so a prior terminal result (a completed/queued send) never lingers into a new send. A NO-OP while a step is in flight (review F1): the screens are exit-able mid-Submitting, so re-entering must RE-ATTACH to the running flow — clobbering the transient here would make the identity guards swallow the landing outcome, hiding a completed send exactly in the re-pay temptation window (mirrors backToForm's in-flight guard).

requestRevoked binds the entering request's revocation to the new flow (see requestRevoked); a revoked request lands on SendRequestExpired instead of a form it could never submit. The default is an organic or live entry, which clears any bit a previous flow carried — an organic send is a new act, never the revoked request's.

Implementation

void resetToForm({bool requestRevoked = false}) {
  if (_inFlight) return;
  // A NEW flow, even when the state value is unchanged (SendForm → SendForm
  // writes the same const and notifies nobody). The id is what tells an
  // ALREADY-MOUNTED screen that the machine is no longer running its flow —
  // without it, an idle entry sitting under a stacked one stays "armed" and
  // books the payment made on top of it.
  _flowId++;
  _requestRevoked = requestRevoked;
  _set(requestRevoked ? const SendRequestExpired() : const SendForm());
}