FLUTTER ECOSYSTEM

kevin-sakemaer/flouter

A router for Flutter based on Navigator 2.0 and Regexp

flouter project cover
Stars
40
Forks
4
Last push (UTC)
Mar 4, 2021
Project status
Active
Kevin Segaud GitHub avatar
GITHUB User

Kevin Segaud ↗

Senior @dart-lang and @flutter developer

@KLEAK-Development ToulouseOfficial website ↗
LanguagesDartHTMLSwiftKotlinObjective-C

Technical topics

Dependencies used

Dependency list 4 items
  • flutter{"sdk":"flutter"}
  • meta^1.3.0
  • provider^5.0.0
  • flutter_testDevelopment{"sdk":"flutter"}

Original README

English project snapshot. Visit GitHub for the latest content.

Expand / collapse project README

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 ;)