Where you can go
When you’re pushing a new screen, you pick one way to say where to go:| Destination | Good for | In Dart | In JSON |
|---|---|---|---|
| Stac screen | Screens from your /stac folder or Stac Cloud | pushStac('screen_name') | routeName + push-style |
| Flutter route | Your app’s own named routes (e.g. settings) | pushFlutter('/path') | routeName + pushNamed etc. |
| Inline JSON | Screen defined right in the action | pushJson({ ... }) | widgetJson |
| Asset | Bundled or offline JSON screens | pushAsset('assets/screen.json') | assetPath |
| Network | Screen fetched from an API | pushNetwork(StacNetworkRequest(...)) | request |
navigationStyle (and optionally result when popping).
Using StacNavigator in Dart
In Dart,StacNavigator gives you clear, type-safe helpers so you don’t hand-build action objects yourself.
Going back: StacNavigator.pop({ result }) pops the current route (and can pass result to the previous one). StacNavigator.popAll() pops back to the root.
Stac screens: pushStac(routeName), pushReplacementStac(routeName), pushAndRemoveAllStac(routeName). Optional arguments on push, optional result on replacement.
Flutter routes: Same pattern with pushFlutter, pushReplacementFlutter, pushAndRemoveAllFlutter—use your app’s route names.
Inline JSON, assets, network: pushJson, pushAsset, pushNetwork (and their pushReplacement* and pushAndRemoveAll* variants) do what the names say. Handy when the screen comes from a blob of JSON, a local file, or an API call.
Navigation styles at a glance
| Style | What it does |
|---|---|
push | New screen on top of the stack |
pop | Dismiss current screen (optional result) |
pushReplacement | Swap current screen for a new one |
pushAndRemoveAll | New screen and clear the stack (e.g. new root) |
popAll | Pop back to the root |
pushNamed / pushReplacementNamed / pushNamedAndRemoveAll | Same as above but for Flutter named routes |
Examples
Each example shows the Dart form (e.g. on a button’sonPressed) and the equivalent JSON you’d use in a Stac action.