Skip to content
forked from Kleak/flouter

A router for Flutter based on Navigator 2.0 and Regexp

License

Notifications You must be signed in to change notification settings

freddyzhu/flouter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Navigator 2.0 router for Flutter

Easy to use router library that do all the work for you !

Easy

First create a MaterialApp.router :

return MaterialApp.router(
    title: 'Uri navigator App',
    routerDelegate: _routerDelegate,
    routeInformationParser: UriRouteInformationParser(),
);

Second initialize your _routerDelegate like this :

final _routerDelegate = UriRouterDelegate(
    pageNotFound: (routeInformation) => MaterialPage(
        key: ValueKey('not-found-page'),
        child: Scaffold(
        body: Center(
            child: Text('Page ${routeInformation.uri.path} not found'),
        ),
        ),
    ),
    initialUris: [
        Uri.parse('/'),
        Uri.parse('/test/titi/'),
    ],
    pages: {
        RegExp(r'^/$'): (_) => HomePage(),
        RegExp(r'^/test/([a-z]+)/$'): (routeInformation) => TestPage(routeInformation),
    },
);

That's all you have to do ;)

About

A router for Flutter based on Navigator 2.0 and Regexp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 87.6%
  • HTML 8.5%
  • Swift 2.3%
  • Kotlin 1.4%
  • Objective-C 0.2%