Skip to main content
The Navigate action performs navigation in a Flutter app from JSON or Dart. For an overview of how navigation works in Stac (destinations, StacNavigator, and when to use each option), see Navigation in Stac. For Flutter’s Navigator model, see the official documentation.

Property reference

You specify where to go with exactly one of: request, widgetJson, assetPath, or routeName. You specify how to go with navigationStyle. For pop-style navigation only navigationStyle (and optionally result) is used.

request

TypeStacNetworkRequest
RequiredNo (optional; use one of request, widgetJson, assetPath, routeName for push-style)
JSON keyrequest
Network request used to load the destination screen JSON. The response body is parsed as Stac widget JSON and shown as the new route. Use for server-driven screens loaded at navigation time. Used with: navigationStyle = push, pushReplacement, or pushAndRemoveAll. See Network Request Action for StacNetworkRequest fields (url, method, headers, body, etc.).

widgetJson

TypeMap<String, dynamic>
RequiredNo (optional; use one of request, widgetJson, assetPath, routeName for push-style)
JSON keywidgetJson
Inline Stac widget tree (JSON map) used as the destination screen. No network or asset load; the screen is defined entirely in the action. Good for one-off or dynamic screens. Used with: navigationStyle = push, pushReplacement, or pushAndRemoveAll.

assetPath

TypeString
RequiredNo (optional; use one of request, widgetJson, assetPath, routeName for push-style)
JSON keyassetPath
Path to a local asset file (e.g. in assets/) that contains the Stac widget JSON for the destination screen. The file is loaded and parsed when navigating. Good for bundled or offline screens. Used with: navigationStyle = push, pushReplacement, or pushAndRemoveAll.

routeName

TypeString
RequiredNo (optional; use one of request, widgetJson, assetPath, routeName for push-style)
JSON keyrouteName
  • With Stac screens (push, pushReplacement, pushAndRemoveAll): name of the Stac screen (e.g. from your /stac folder or Stac Cloud). The Stac runtime resolves it to a widget (e.g. via Stac(routeName: routeName)).
  • With Flutter named routes (pushNamed, pushReplacementNamed, pushNamedAndRemoveAll): the route name registered in your app’s route table (e.g. '/home', '/settings').
Used with: any push-style navigationStyle. For Flutter routes use pushNamed, pushReplacementNamed, or pushNamedAndRemoveAll; for Stac screens use push, pushReplacement, or pushAndRemoveAll.
TypeNavigationStyle (enum)
RequiredNo (defaults to push when a destination is provided)
JSON keynavigationStyle
Controls how the navigation is performed: push, pop, replace, or clear stack. When omitted and a destination is given, behavior is push. Values:
ValueDescription
pushPushes a new route on top of the current one. Use with request, widgetJson, assetPath, or routeName (Stac screen).
popPops the current route. Optional result is returned to the previous route. No destination.
pushReplacementReplaces the current route with a new one. Use with request, widgetJson, assetPath, or routeName. Optional result for the replaced route.
pushAndRemoveAllPushes a new route and removes all routes below it. Use with request, widgetJson, assetPath, or routeName.
popAllPops until the root route. No destination.
pushNamedPushes a Flutter named route. Use with routeName (and optionally arguments).
pushReplacementNamedReplaces the current route with a Flutter named route. Use with routeName; optional result and arguments.
pushNamedAndRemoveAllPushes a Flutter named route and removes all previous routes. Use with routeName and optionally arguments.

result

TypeMap<String, dynamic>
RequiredNo
JSON keyresult
Data returned to the previous route when the current route is removed.
  • pop: passed as the second argument to Navigator.pop(context, result).
  • pushReplacement / pushReplacementNamed: passed as the result to the replacement call so the previous route receives it when the new route is later popped.

arguments

TypeMap<String, dynamic>
RequiredNo
JSON keyarguments
Arguments passed to the new route. For Stac screens (push/pushReplacement/pushAndRemoveAll + routeName), the Stac runtime can use these when building the screen. For Flutter named routes (pushNamed, pushReplacementNamed, pushNamedAndRemoveAll), this is the arguments object passed to Navigator.pushNamed(..., arguments: arguments). For examples (Dart and JSON), see Navigation in Stac.