Skip to main content
Stac uses the same idea as Flutter’s Navigator: you push new screens, pop back, or replace the current one. The difference is you can drive it from JSON (e.g. from your backend) or from Dart, and the next screen can be a Stac screen, a Flutter route, or a screen loaded from inline JSON, an asset, or the network.

Where you can go

When you’re pushing a new screen, you pick one way to say where to go: Going back is simpler: use pop or popAll with 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.

Examples

Each example shows the Dart form (e.g. on a button’s onPressed) and the equivalent JSON you’d use in a Stac action.

Pop and popAll

Push a Stac screen

Push a Flutter named route

Push a screen from inline JSON

Push a screen from an asset

Push a screen from the network

Replace and clear stack

For full property details, see the Navigate Action reference.