BeamerLocationBuilder
https://github.com/slovnicki/beamer/tree/master/examples/location_builders/lib
MaterialApp.router
Two important properties of MaterialApp.router when used inside RoutesLocationBuilder are:
routeInformationParser: it always takeBeamerParser()routerDelegate: for simplicity, I am using a varaiblerouterDelegatewhich is declared separately asfinalbackButtonDispatcher: Integration of Android's back button is achieved by setting a backButtonDispatcher inMaterialApp.router. This dispatcher needs a reference to the same BeamerDelegate that is set for routerDelegate.
return MaterialApp.router(
routeInformationParser: BeamerParser(),
routerDelegate: routerDelegate,
backButtonDispatcher: BeamerBackButtonDispatcher(delegate: routerDelegate),
);
1. routerDelegate
was declared as
routerDelegate: routerDelegate,inside theMaterialApp.router(..)
I am using a varaible routerDelegate which is declared separately as final
calling '/home'
final routerDelegate = BeamerDelegate(
initialPath: '/home',
locationBuilder: RoutesLocationBuilder(
routes: {
'*': (context, state, data) => Home(),
},
),
);