captain 0.0.2
captain: ^0.0.2 copied to clipboard

Flutter Android iOS Linux macOS web Windows

declarative routing with an imperative facade

Captain #

an imperative way to navigate declaratively

Placing it in the widget tree #

place the Captain()widget at the same postition inside your widget tree where your Router or Navigator widget would reside. Best practice is placing the main Router beneath the Material/Cupertino/WidgetsApp like:


...
    MaterialApp(
        home: Captain(
            pages: ...,
            ...
        ),
    ),


Captain supports imperative navigation style by complying to the Navigator.of(context) format

Use either:

  • .action(Object actionKey)for invoking predefined actions that have been registered to the Captain Widget
  • .actionFunc(List<Page> Function(List<Page>)) which takes a List

Example #


Navigator.of(context).action("myActionKey");
Navigator.of(context).actionFunc((pageStack) => pageStack..add(pageToAdd));

2
likes
90
pub points
0%
popularity

declarative routing with an imperative facade

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

niklas@quantumgray.tech

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on captain