locationBuilder property

LocationBuilder locationBuilder
final

A builder for BeamLocations.

There are 3 ways of building an appropriate BeamLocation which will in turn build a stack of pages that should go into Navigator.pages.

  1. 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());
},
  1. BeamerLocationBuilder; chooses appropriate BeamLocation itself
locationBuilder: BeamerLocationBuilder(
  beamLocations: [
    Location1(),
    Location2(),
  ],
),
  1. RoutesLocationBuilder; a Map of routes
locationBuilder: RoutesLocationBuilder(
  routes: {
    '/': (context, state) => HomeScreen(),
    '/another': (context, state) => AnotherScreen(),
  },
),

Implementation

final LocationBuilder locationBuilder;