universal_router pub package

This package is a implementation of Navigator 2.0. Supported Router Table concept.

Features

  • Easy to use.
  • Router table concept.
  • Various parameter setting.

Install

Install by adding this package to your pubspec.yaml:

dependencies:
  universal_router: ^[latest version]

Usage

Import

import 'package:universal_router/route.dart';

Simple Example


import 'package:universal_router/route.dart';



void main() {
  final universalRouter = UniversalRouter.initialize();

  RouteInstance(
      routePath: "",
      title: "Home",
      pageBuilder: (_, __) async => Home());

  runApp(
      MaterialApp.router(
        routerDelegate: universalRouter.routerDelegate,
        routeInformationProvider: universalRouter.routeInformationProvider,
        routeInformationParser: universalRouter.routerInformationParser,
      ));
}

class Home extends StatelessWidget {

  @override
  Widget build(BuildContext context) =>
      TextButton(onPressed: () => {UniversalRouter.changePath("somewhere")},
          child: Text('go to somewhere else'));

}


License

Copyright © 2021, Jialin Li.
Released under the GNU AGPLv3.