๐Ÿš‚Routing

Contextless navigation service

Are you frustrated about using BuildContext everytime when you navigate? Here comes the solution.

Pulse-X's navigation service relies on BuildContext but you won't have to use context everytime when you navigates to a screen or pops back to the original screen.

๐Ÿšง Pulse-X's navigator is still under implementation stage and only three functions have been implemented.

  • push

  • pushNamed

  • pop

But, first you'll have to do a few things in order to get contextless navigation.

Step 1:

Register Pulse-X's navigator key in your MaterialApp like this.

// ...your code...
MaterialApp(
    // other stuff
    navigatorKey: PulseXNavigator.navigatorKey,// register pulse's navigator key
);
// ...your code...

Step 2:

Register Pulse-X's navigation service in your dependency injection section like this.

PulseXInjector injector = PulseXInjector.instance;
injector.registerLazySingleton(() => PulseXNavigator());

Final Step:

Now, you can use Pulse-X's navigation service easily.

You can await return values from another screen.

For push method,

For pushNamed method,

๐Ÿšง still coding and testing, I'll let you know when it's ready

For pop method,

You can return arguments from pop method like this.

Last updated