captain 0.0.2-null-safety copy "captain: ^0.0.2-null-safety" to clipboard
captain: ^0.0.2-null-safety copied to clipboard

outdated

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));

7
likes
0
pub points
0%
popularity

Publisher

verified publisherquantumgray.tech

declarative routing with an imperative facade

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on captain