NavigationService class

Provides a service that can be injected into the ViewModels for navigation.

Uses the Get library for all navigation requirements

Constructors

Properties

currentArguments → dynamic
Returns the current arguments
no setter
currentRoute String
Returns the current route
no setter
hashCode int
The hash code for this object.
no setterinherited
no setter
previousRoute String
Returns the previous route
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

back<T>({dynamic result, int? id}) bool
Pops the current scope and indicates if you can pop again
clearStackAndShow<T>(String routeName, {dynamic arguments, int? id, Map<String, String>? parameters}) Future<T?>?
Clears the entire back stack and shows routeName
clearStackAndShowView<T>(Widget view, {dynamic arguments, int? id}) Future<T?>?
Clears the entire back stack and shows view
clearTillFirstAndShow<T>(String routeName, {dynamic arguments, int? id, bool preventDuplicates = true, Map<String, String>? parameters}) Future<T?>?
Pops the navigation stack until there's 1 view left then pushes routeName onto the stack
clearTillFirstAndShowView<T>(Widget view, {dynamic arguments, int? id}) Future<T?>?
Pops the navigation stack until there's 1 view left then pushes view onto the stack
config({bool? enableLog, bool? defaultPopGesture, bool? defaultOpaqueRoute, Duration? defaultDurationTransition, bool? defaultGlobalState, Transition? defaultTransitionStyle, String? defaultTransition}) → void
Allows you to configure the default behaviour for navigation.
Pushes routeName onto the navigation stack
Pushes view onto the navigation stack
Pushes page onto the navigation stack. This uses the page itself (Widget) instead of routeName (String).
nestedNavigationKey(int index) GlobalKey<NavigatorState>?
Creates and/or returns a new navigator key based on the index passed in
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
popRepeated(int popTimes) → void
Pops the back stack the number of times you indicate with popTimes
popUntil(RoutePredicate predicate, {int? id}) → void
Pops the back stack until the predicate is satisfied
pushNamedAndRemoveUntil<T>(String routeName, {RoutePredicate? predicate, dynamic arguments, int? id}) Future<T?>?
Push route and clear stack until predicate is satisfied
replaceWith<T>(String routeName, {dynamic arguments, int? id, bool preventDuplicates = true, Map<String, String>? parameters, RouteTransitionsBuilder? transition}) Future<T?>?
Replaces the current route with the routeName
replaceWithTransition<T>(Widget page, {bool? opaque, String transition = '', Duration? duration, bool? popGesture, int? id, Curve? curve, bool fullscreenDialog = false, bool preventDuplicates = true, Transition? transitionClass, Transition? transitionStyle, String? routeName}) Future<T?>?
Replaces current view in the navigation stack. This uses the page itself (Widget) instead of routeName (String).
toString() String
A string representation of this object.
inherited

Operators

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