onTransition property

KaiselTransitionCallback<R>? onTransition
final

Called after the stack changes, with the old and new stacks as route values.

Fires for every committed change — push, pop, replaceTop, set, and Navigator-driven removals (system back) — after guards have run and listeners have been notified. It does not fire for no-op navigations (a proposed stack equal to the current one), on construction, or for a modal flow's own sub-stack.

The value model makes transitions directly comparable: a master-detail swap is from.length == to.length && from.last != to.last. Navigating from inside the callback is safe — the new navigation is queued like any other.

Implementation

final KaiselTransitionCallback<R>? onTransition;