Learn

Stack and branch operations

Select an operation from its exact stack effect and keep commit separate from route completion.

v0.1.0-dev.2Intermediate

Stack and branch operations

There is no generic operation whose name conceals the mutation. Use push, replaceTop, reconfigureTop, replaceAll, setStack, pushAndRemoveUntil, replaceTail, popUntil, remove, activateBranch, or resetBranch according to the required result.

Entry-creating operations return NavigationTicket<R> with two independent futures:

  • committed completes after resolution and policies;
  • completed completes when the entry is popped, removed, or never committed.
dart
final ticket = navigation.push<bool>(
  const ProductDestination(productId: 'keyboard-42'),
);

if (await ticket.committed case NavigationCommitted()) {
  switch (await ticket.completed) {
    case NavigationPopped<bool>(:final result):
      applySelection(result);
    case NavigationRemoved<bool>():
      handleFlowRewrite();
    case NavigationNotCommitted<bool>():
      throw StateError('Impossible after commit.');
  }
}

Stack identity and browser history are separate. Every mutation accepts a NavigationHistoryMode, allowing an atomic replaceAll to create a user-visible history entry or a Redirect to replace the inaccessible location.

ARKTELOS

Purpose-built engineering systems for software that has to hold.