captain 0.0.2-nullsafety.1 copy "captain: ^0.0.2-nullsafety.1" to clipboard
captain: ^0.0.2-nullsafety.1 copied to clipboard

outdated

declarative routing with an imperative facade. Captain manages Router (Navigator 2.0) logic by providing well defined API in old school format

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
points
22
downloads

Publisher

verified publisherquantumgray.tech

Weekly Downloads

declarative routing with an imperative facade. Captain manages Router (Navigator 2.0) logic by providing well defined API in old school format

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on captain