BeamerDelegate<T extends BeamState> constructor

BeamerDelegate<T extends BeamState>({
  1. required LocationBuilder locationBuilder,
  2. String initialPath = '/',
  3. void listener(
    1. BeamState,
    2. BeamLocation<BeamState>
    )?,
  4. T createState(
    1. BeamState state
    )?,
  5. bool preferUpdate = true,
  6. bool removeDuplicateHistory = true,
  7. BeamPage? notFoundPage,
  8. BeamLocation<BeamState>? notFoundRedirect,
  9. String? notFoundRedirectNamed,
  10. List<BeamGuard> guards = const <BeamGuard>[],
  11. List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[],
  12. TransitionDelegate transitionDelegate = const DefaultTransitionDelegate(),
  13. TransitionDelegate beamBackTransitionDelegate = const ReverseTransitionDelegate(),
  14. bool onPopPage(
    1. BuildContext context,
    2. Route route,
    3. dynamic result
    )?,
  15. bool setBrowserTabTitle = true,
  16. bool updateFromParent = true,
  17. bool updateParent = true,
})

Implementation

BeamerDelegate({
  required this.locationBuilder,
  this.initialPath = '/',
  this.listener,
  this.createState,
  this.preferUpdate = true,
  this.removeDuplicateHistory = true,
  this.notFoundPage,
  this.notFoundRedirect,
  this.notFoundRedirectNamed,
  this.guards = const <BeamGuard>[],
  this.navigatorObservers = const <NavigatorObserver>[],
  this.transitionDelegate = const DefaultTransitionDelegate(),
  this.beamBackTransitionDelegate = const ReverseTransitionDelegate(),
  this.onPopPage,
  this.setBrowserTabTitle = true,
  this.updateFromParent = true,
  this.updateParent = true,
}) {
  notFoundPage ??= BeamPage(
    title: 'Not found',
    child: Container(child: Center(child: Text('Not found'))),
  );

  createState ??= (BeamState state) => BeamState.fromUri(
        state.uri,
        data: state.data,
      ) as T;

  _currentTransitionDelegate = transitionDelegate;

  state = createState!(BeamState.fromUriString(initialPath));
  _currentBeamLocation = EmptyBeamLocation();
}