oobium_routing 0.1.2 icon indicating copy to clipboard operation
oobium_routing: ^0.1.2 copied to clipboard

Simplified routing for Navigator 2.0. Type-safe, semi-declarative, supporting bidirectional browser address bar and nested routers.

oobium_routing #

pub package

Simplified routing for Flutter's Navigator 2.0.

  • type-safe
  • semi-declarative
  • browser address bar (bidi)
  • nested routers

Usage #

To use this plugin, add oobium_routing as a dependency in your pubspec.yaml file.

Example #

final routes = AppRoutes()
	..add<AuthorsRoute>(
		path: '/authors',
		onParse: (data) => AuthorsRoute(),
		onBuild: (ref) => [AuthorsPage()]
	)
	..add<BooksRoute>(
		path: '/books',
		onParse: (data) => BooksRoute(),
		onBuild: (ref) => [BooksPage()]
	);

void main() => runApp(MaterialApp.router(
    title: 'NavDemo',
    routeInformationParser: routes.createRouteParser(),
    routerDelegate: routes.createRouterDelegate()
));

class ExampleView extends StatelessWidget {

	Widget build(BuildContext context) {
		return Center(child: Row(children: [
			ElevatedButton(
				child: Text('Authors'),
				onPressed: () => context.route = AuthorsRoute(),
			),
			ElevatedButton(
				child: Text('Books'),
				onPressed: () => context.route = BooksRoute(),
			),
			ElevatedButton.icon(
				icon: Icon(Icons.arrow_back),
				label: Text('Back'),
				onPressed: () => Navigator.pop(context),
			),
		],),);
	}
}
1
likes
120
pub points
15%
popularity

Publisher

unverified uploader

Simplified routing for Navigator 2.0. Type-safe, semi-declarative, supporting bidirectional browser address bar and nested routers.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on oobium_routing