named_routes 0.0.1 copy "named_routes: ^0.0.1" to clipboard
named_routes: ^0.0.1 copied to clipboard

discontinuedreplaced by: routerino
outdated

Add names to routes without a declarative design pattern

named_routes #

This opinionated package provides extension methods for BuildContext to push routes.

...and automatically add a name to the route so you can track it in sentry!

Motivation #

I don't like to manually declare all routes and just push a widget and that's it!

The problems:

  1. Pushing a new route requires lots of boilerplate.
  2. I want to add some name to the route in order to track it in sentry.
Navigator.push<T>(
  context,
  MaterialPageRoute(
    builder: (_) => LoginPage(),
    settings: RouteSettings(name: 'LoginPage'), // so redundant!
  ),
);

Usage #

Pushing a route:

// push a new route
context.push(() => MyPage());

// push a route while removing all others
context.pushRoot(() => MyPage());

// push a route while removing all others (without animation)
context.pushRootNoAnimation(() => MyPage());

Sentry #

You want it to look like this?

[sentry]

MaterialApp(
  navigatorObservers: [
    SentryNavigatorObserver(), // add this 
  ],
  home: const InitPage(),
);
1
likes
0
points
3
downloads

Publisher

verified publishertienisto.com

Weekly Downloads

Add names to routes without a declarative design pattern

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on named_routes