locationBuilder property
A builder for BeamLocations.
There are 3 ways of builfing an appropriate BeamLocation which will in turn build a stack of pages that should go into Navigator.pages.
- Custom closure
locationBuilder: (state) {
if (state.uri.pathSegments.contains('l1')) {
return Location1(state);
}
if (state.uri.pathSegments.contains('l2')) {
return Location2(state);
}
return NotFound(path: state.uri.toString());
},
- BeamerLocationBuilder; chooses appropriate BeamLocation itself
locationBuilder: BeamerLocationBuilder(
beamLocations: [
Location1(),
Location2(),
],
),
- SimpleLocationBuilder; a Map of routes
locationBuilder: SimpleLocationBuilder(
routes: {
'/': (context) => HomeScreen(),
'/another': (context) => AnotherScreen(),
},
),
Implementation
final LocationBuilder locationBuilder;