VRouterDelegate class

Inheritance
Mixed in types

Constructors

VRouterDelegate({required List<VRouteElement> routes, Widget builder(BuildContext context, Widget child)?, List<NavigatorObserver> navigatorObservers = const [], Future<void> beforeEnter(VRedirector vRedirector) = VoidVGuard.voidBeforeEnter, Future<void> beforeLeave(VRedirector vRedirector, void saveHistoryState(Map<String, String> historyState)) = VoidVGuard.voidBeforeLeave, void afterEnter(BuildContext context, String? from, String to) = VoidVGuard.voidAfterEnter, Future<void> onPop(VRedirector vRedirector) = VoidVPopHandler.voidOnPop, Future<void> onSystemPop(VRedirector vRedirector) = VoidVPopHandler.voidOnSystemPop, Widget buildTransition(Animation<double> animation, Animation<double> secondaryAnimation, Widget child)?, Duration? transitionDuration, Duration? reverseTransitionDuration, String initialUrl = '/', List<VLogLevel> logs = VLogs.info, GlobalKey<NavigatorState>? navigatorKey})

Properties

builder → (Widget Function(BuildContext context, Widget child)?)
Build widget before the pages The context can be used to access VRouter.of
final
buildTransition → (Widget Function(Animation<double> animation, Animation<double> secondaryAnimation, Widget child)?)
If implemented, this becomes the default transition for every route transition except those who implement there own buildTransition Also see:
final
currentConfiguration RouteInformation?
App state to navigation state
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
historyState Map<String, String>
This state is saved in the browser history. This means that if the user presses the back or forward button on the navigator, this historyState will be the same as the last one you saved.
getter/setter pair
initialUrl String
This allows you to change the initial url
final
logs List<VLogLevel>
The VRouter logs that are to be shown
final
names List<String>
A list of every names corresponding to the VRouteElements in the current stack
no setter
Those are used in the root navigator They are here to prevent breaking animations
final
The list of observers for the Navigator created for this app.
final
pathParameters Map<String, String>
Maps all route parameters (i.e. parameters of the path mentioned as ":someId")
getter/setter pair
previousUrl String?
Previous url that was synced with the state
getter/setter pair
queryParameters Map<String, String>
Contains all query parameters (i.e. parameters after the "?" in the url) of the current url
getter/setter pair
reverseTransitionDuration Duration?
The reverse duration of VRouter.buildTransition
final
routes List<VRouteElement>
This list holds every possible routes of your app
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
transitionDuration Duration?
The duration of VRouter.buildTransition
final
url String?
Url currently synced with the state
getter/setter pair

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
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).
inherited
historyBack() → void
Goes back 1 in the url history
historyCanBack() bool
Check whether going back 1 in the history url is possible
historyCanForward() bool
Check whether going forward 1 in the history url is possible
historyCanGo(int delta) bool
Check whether jumping of delta in the history url is possible
historyForward() → void
Goes forward 1 in the url history
historyGo(int delta) → void
Goes jumps of delta in the url history
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pop({Map<String, String> pathParameters = const {}, Map<String, String> queryParameters = const {}, String? hash, Map<String, String> newHistoryState = const {}}) Future<void>
Starts a pop cycle
popRoute() Future<bool>
handles systemPop
override
push(String newUrl, {Map<String, String> queryParameters = const {}, Map<String, String> historyState = const {}}) → void
Pushes the new route of the given url on top of the current one A path can be of one of two forms:
pushExternal(String newUrl, {bool openNewTab = false}) → void
Goes to an url which is not in the app
pushNamed(String name, {Map<String, String> pathParameters = const {}, Map<String, String> queryParameters = const {}, Map<String, String> historyState = const {}}) → void
Updates the url given a VRouteElement name
pushReplacement(String newUrl, {Map<String, String> queryParameters = const {}, Map<String, String> historyState = const {}}) → void
Replace the current one by the new route corresponding to the given url The difference with push is that this overwrites the current browser history entry If you are on mobile, this is the same as push Path can be of one of two forms:
pushReplacementNamed(String name, {Map<String, String> pathParameters = const {}, Map<String, String> queryParameters = const {}, Map<String, String> historyState = const {}}) → void
Replace the url given a VRouteElement name The difference with pushNamed is that this overwrites the current browser history entry
pushSegments(List<String> segments, {Map<String, String> queryParameters = const {}, Map<String, String> historyState = const {}}) → void
Pushes a new url based on url segments
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replaceHistoryState(Map<String, String> newHistoryState) → void
This replaces the current history state of VRouter with given one
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 routeInformation) Future<void>
Navigation state to app state
override
setRestoredRoutePath(RouteInformation configuration) Future<void>
Called by the Router during state restoration.
inherited
systemPop({Map<String, String> pathParameters = const {}, Map<String, String> queryParameters = const {}, String? hash, Map<String, String> newHistoryState = const {}}) Future<void>
Starts a systemPop cycle
to(String path, {Map<String, String> queryParameters = const {}, String? hash, Map<String, String> historyState = const {}, dynamic isReplacement = false}) → void
The main method to navigate to a new path
toExternal(String newUrl, {bool openNewTab = false}) → void
Goes to an url which is not in the app
toNamed(String name, {Map<String, String> pathParameters = const {}, Map<String, String> queryParameters = const {}, String? hash, Map<String, String> historyState = const {}, bool isReplacement = false}) → void
pathParameters needs to specify every path parameters contained in the path corresponding to name
toSegments(List<String> segments, {Map<String, String> queryParameters = const {}, String? hash, Map<String, String> historyState = const {}, dynamic isReplacement = false}) → void
Navigates to a new url based on path segments
toString() String
A string representation of this object.
inherited

Operators

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