rc_router 0.2.0 copy "rc_router: ^0.2.0" to clipboard
rc_router: ^0.2.0 copied to clipboard

outdated

A simple but powerful Flutter router.

codecov

rc_router #

A simple but powerful router for Flutter

Usage #

Create a custom RcRoute #

The code below is based on what you have in the example app

class HomeRoute extends RcRoute {
  static String routePath = '/';

  HomeRoute() : super(path: HomeRoute.routePath);

  @override
  Widget build(BuildContext context) {
    final name = 'anonymous';
    return Provider<String>.value(
      value: name,
      child: WelcomePage(),
    );
  }
}

Create RcRoutes #

...
  @override
  void initState() {
    super.initState();
    rcRoutes = RcRoutes(
      notFoundRoute: generateNotFound,
      routes: [
        HomeRoute(),
        GrettingsRoute(),
      ],
    );
  }
...

Use RcRoutes #

@override
Widget build(BuildContext context) {
  return MaterialApp(
    title: 'Flutter Demo',
    theme: ThemeData(
      primarySwatch: Colors.blue,
    ),
    onGenerateRoute: rcRoutes.onGeneratedRoute,
  );
}
1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A simple but powerful Flutter router.

Homepage

License

MIT (license)

Dependencies

flutter, pedantic, provider

More

Packages that depend on rc_router