BeamerDelegate class

A delegate that is used by the Router to build the Navigator.

This is "the beamer", the one that does the actual beaming.

Inheritance
Mixed in types

Constructors

BeamerDelegate({required LocationBuilder locationBuilder, String initialPath = '/', void routeListener(RouteInformation, BeamerDelegate)?, void buildListener(BuildContext, BeamerDelegate)?, Listenable? updateListenable, @Deprecated('No longer used by this package, please remove any references to it. ' 'This feature was deprecated after v1.0.0.') bool preferUpdate = true, bool removeDuplicateHistory = true, BeamPage notFoundPage = BeamPage.notFound, BeamLocation<RouteInformationSerializable>? notFoundRedirect, String? notFoundRedirectNamed, List<BeamGuard> guards = const <BeamGuard>[], List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[], TransitionDelegate transitionDelegate = const DefaultTransitionDelegate(), TransitionDelegate beamBackTransitionDelegate = const ReverseTransitionDelegate(), bool onPopPage(BuildContext context, Route route, dynamic result)?, bool setBrowserTabTitle = true, bool initializeFromParent = true, bool updateFromParent = true, bool updateParent = true, Set<String> clearBeamingHistoryOn = const <String>{}})
Creates a BeamerDelegate with specified properties.

Properties

active bool
If false, does not report the route until next update.
getter/setter pair
beamBackTransitionDelegate TransitionDelegate
A transition delegate to be used by Navigator when beaming back.
final
beamingHistory List<BeamLocation<RouteInformationSerializable>>
The history of BeamLocations, each holding its BeamLocation.history.
final
beamingHistoryCompleteLength int
Returns the complete length of beaming history, that is the sum of all history lengths for each BeamLocation in beamingHistory.
no setter
buildListener → (void Function(BuildContext, BeamerDelegate)?)
The buildListener will be called every time after the currentPages are updated. it receives a reference to this delegate.
final
canBeamBack bool
Whether it is possible to beamBack, i.e. there is more than 1 entry in beamingHistoryCompleteLength.
no setter
canPopBeamLocation bool
Whether it is possible to popBeamLocation, i.e. there is more than 1 location in beamingHistory.
no setter
clearBeamingHistoryOn Set<String>
Whether to remove all entries from beamingHistory (and their nested BeamLocation.history) when a route belonging to this set is reached, regardless of how it was reached.
final
configuration RouteInformation
A state of this delegate. This is the routeInformation that goes into locationBuilder to build an appropriate BeamLocation.
getter/setter pair
currentBeamLocation BeamLocation<RouteInformationSerializable>
A BeamLocation that is currently responsible for providing a page stack via BeamLocation.buildPages and holds the current BeamState.
no setter
currentConfiguration RouteInformation?
Called by the Router when it detects a route information may have changed as a result of rebuild.
no setteroverride
currentPages List<BeamPage>
currentBeamLocation's "effective" pages, the ones that were built.
no setter
guards List<BeamGuard>
Guards that will be executing BeamGuard.check on currentBeamLocation candidate.
final
hashCode int
The hash code for this object.
no setteroverride
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
initializeFromParent bool
Whether to take configuration from parent when this is created.
final
initialPath String
The path to replace / as default initial route path upon load.
final
locationBuilder LocationBuilder
A builder for BeamLocations.
final
The Navigator that belongs to this BeamerDelegate.
no setter
The key used for retrieving the current navigator.
no setteroverride
The list of observers for the Navigator.
final
notFoundPage BeamPage
Page to show when no BeamLocation supports the incoming URI.
getter/setter pair
notFoundRedirect BeamLocation<RouteInformationSerializable>?
BeamLocation to redirect to when no BeamLocation supports the incoming URI.
final
notFoundRedirectNamed String?
URI string to redirect to when no BeamLocation supports the incoming URI.
final
onPopPage ↔ (bool Function(BuildContext context, Route route, dynamic result)?)
Callback when pop is requested.
getter/setter pair
parent BeamerDelegate?
A delegate of a parent of the Beamer that has this delegate.
getter/setter pair
preferUpdate bool
final
removeDuplicateHistory bool
Whether to remove BeamLocations from beamingHistory if they are the same type as the location being beamed to.
final
root BeamerDelegate
The top-most BeamerDelegate, a parent of all.
no setter
routeListener → (void Function(RouteInformation, BeamerDelegate)?)
The routeListener will be called on every navigation event and will receive the configuration and a reference to this delegate.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setBrowserTabTitle bool
Whether the title attribute of BeamPage should be used to set and update the browser tab title.
final
transitionDelegate TransitionDelegate
A transition delegate to be used by Navigator.
final
updateFromParent bool
Whether to call update when parent notifies listeners.
final
updateListenable Listenable?
A Listenable to which an update listener will be added, i.e. update will be called when listeners are notified.
final
updateParent bool
Whether to call update on parent when this instance's configuration is updated.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
beamBack({Object? data, bool replaceRouteInformation = false}) bool
Beams to previous entry in beamingHistory. and removes the last entry from history.
beamTo(BeamLocation<RouteInformationSerializable> location, {Object? data, BeamLocation<RouteInformationSerializable>? popTo, TransitionDelegate? transitionDelegate, bool beamBackOnPop = false, bool popBeamLocationOnPop = false, bool stacked = true, bool replaceRouteInformation = false}) → void
Beams to a specific, manually configured BeamLocation.
beamToNamed(String uri, {Object? routeState, Object? data, String? popToNamed, TransitionDelegate? transitionDelegate, bool beamBackOnPop = false, bool popBeamLocationOnPop = false, bool stacked = true, bool replaceRouteInformation = false}) → void
Configures and beams to a BeamLocation that supports uri within its BeamLocation.pathPatterns.
beamToReplacement(BeamLocation<RouteInformationSerializable> location, {Object? data, BeamLocation<RouteInformationSerializable>? popTo, TransitionDelegate? transitionDelegate, bool beamBackOnPop = false, bool popBeamLocationOnPop = false, bool stacked = true}) → void
The same as beamTo, but replaces the last state in history, i.e. removes it from the beamingHistory.last.history and then does beamTo.
beamToReplacementNamed(String uri, {Object? routeState, Object? data, String? popToNamed, TransitionDelegate? transitionDelegate, bool beamBackOnPop = false, bool popBeamLocationOnPop = false, bool stacked = true}) → void
The same as beamToNamed, but replaces the last state in history, i.e. removes it from the beamingHistory.last.history and then does beamToNamed.
build(BuildContext context) Widget
Called by the Router to obtain the widget tree that represents the current state.
override
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
popBeamLocation({Object? data, bool replaceRouteInformation = false}) bool
Beams to previous location in beamingHistory and removes the last location from history.
popRoute() Future<bool>
Called by the Router when the Router.backButtonDispatcher reports that the operating system is requesting that the current route be popped.
inherited
popToNamed(String uri, {Object? routeState, Object? data, String? popToNamed, bool beamBackOnPop = false, bool popBeamLocationOnPop = false, bool stacked = true, bool replaceRouteInformation = false}) → void
Calls beamToNamed with a ReverseTransitionDelegate and tries to remove everything from history after entry corresponding to uri, as if doing a pop way back to that state, if it exists in history.
removeFirstHistoryElement() HistoryElement?
Removes the first element from beamingHistory and returns it.
removeLastHistoryElement() HistoryElement?
Removes the last element from beamingHistory and returns it.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setInitialRoutePath(RouteInformation configuration) SynchronousFuture<void>
Called by the Router at startup with the structure that the RouteInformationParser obtained from parsing the initial route.
override
setNewRoutePath(RouteInformation configuration) SynchronousFuture<void>
Called by the Router when the Router.routeInformationProvider reports that a new route has been pushed to the application by the operating system.
override
setRestoredRoutePath(RouteInformation configuration) Future<void>
Called by the Router during state restoration.
inherited
takePriority() → void
Takes priority over all other siblings, i.e. sets itself as active and all other siblings as inactive.
toString() String
A string representation of this object.
inherited
update({RouteInformation? configuration, BeamParameters? beamParameters, Object? data, bool buildBeamLocation = true, bool rebuild = true, bool updateParent = true, bool updateRouteInformation = true, bool replaceRouteInformation = false, bool takePriority = true}) → void
Main method to update the configuration of this delegate and its currentBeamLocation.
updateRouteInformation(RouteInformation routeInformation) → void
Pass this call to root which notifies the platform for a configuration change.

Operators

operator ==(Object other) bool
The equality operator.
override