From a5174947d854b2029e18cfd9169333909a6fd030 Mon Sep 17 00:00:00 2001 From: Codefarmer Date: Sat, 29 Aug 2026 14:39:16 +0100 Subject: [PATCH 1/2] docs: note that pop completes a flow from its first screen --- skills/kaisel/NAVIGATION.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/skills/kaisel/NAVIGATION.md b/skills/kaisel/NAVIGATION.md index d847185..7792f13 100644 --- a/skills/kaisel/NAVIGATION.md +++ b/skills/kaisel/NAVIGATION.md @@ -141,7 +141,24 @@ guard blocked the mutation. Pass an optional `result` to hand a value back to a matching `pushForResult` awaiter. **Use for:** Back buttons, "cancel" actions, and returning a value from -a screen opened with `pushForResult`. +a screen opened with `pushForResult` or `run`. + +**On the first screen of a modal flow**, `context.pop(result)` completes +the flow with `result` rather than doing nothing — the same thing the system +back button does there. So one screen can serve as both a pushed page and a +flow root without knowing which it is in: + +```dart +// Works either way: pushed with pushForResult, or run. +FilledButton( + onPressed: () => context.pop(draft), + child: const Text('Save'), +) +``` + +(This applies to the terse `context.pop`, which can see the enclosing flow. +`router.pop()` on a flow's sub-router still just reports `false` at its +root — the router has no view of the widget tree.) **Notes:** @@ -157,8 +174,6 @@ a screen opened with `pushForResult`. guard can prevent a pop (e.g. a form-dirty guard that asks "discard changes?"); `pop` then returns `false`. Always check the boolean if you care whether it happened. -- A guard can prevent a pop (e.g., a form-dirty guard that asks - "discard changes?"). Always check the boolean if you care. ## maybePop From 743e1a7caf3bf0da10d35d01c562b05fee32377d Mon Sep 17 00:00:00 2001 From: Codefarmer Date: Sat, 29 Aug 2026 14:49:01 +0100 Subject: [PATCH 2/2] docs: drop dashes from the pop flow-root note --- skills/kaisel/NAVIGATION.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/skills/kaisel/NAVIGATION.md b/skills/kaisel/NAVIGATION.md index 7792f13..f0f2c61 100644 --- a/skills/kaisel/NAVIGATION.md +++ b/skills/kaisel/NAVIGATION.md @@ -144,8 +144,8 @@ back to a matching `pushForResult` awaiter. a screen opened with `pushForResult` or `run`. **On the first screen of a modal flow**, `context.pop(result)` completes -the flow with `result` rather than doing nothing — the same thing the system -back button does there. So one screen can serve as both a pushed page and a +the flow with `result` rather than doing nothing. That is what the system +back button already does there. So one screen can serve as both a pushed page and a flow root without knowing which it is in: ```dart @@ -158,7 +158,7 @@ FilledButton( (This applies to the terse `context.pop`, which can see the enclosing flow. `router.pop()` on a flow's sub-router still just reports `false` at its -root — the router has no view of the widget tree.) +root, because the router has no view of the widget tree.) **Notes:**