NavigationUtils class
Navigation helpers shared by ContextNavigationExtensions and MultilevelNavigatorExtensions — takes a GoRouter directly for flexibility.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
calculateTargetPathForPop(
{required String currentPath, required int? level, required int? levelFromRouteName, required int pathDepth}) → String? -
clearAllFeaturePaths(
NavigationStorage storage) → void -
clearFeaturePath(
NavigationStorage storage, String featureKey) → void -
closeAllModals(
GoRouter router) → void -
closeModal(
GoRouter router, String modalId) → void -
Removes
modalIdfrom themodalquery parameter, dropping the parameter entirely if it was the last one open. -
closeModalAsync(
GoRouter router, String modalId) → Future< void> -
closeModalInUri(
Uri currentUri, String modalId) → Uri -
closeModalWithResult<
T> (GoRouter router, NavigationStorage storage, String modalId, T? result) → void -
completeModalWithNull(
NavigationStorage storage, String modalId) → void -
completeModalWithResult<
T> (NavigationStorage storage, String modalId, T? result) → void - Completes the modal's Completer without closing it — used internally by MultilevelModalOverlay.
-
getCurrentExtra(
GoRouter router) → Object? -
getCurrentFragment(
GoRouter router) → String -
getCurrentQueryParameters(
GoRouter router) → Map< String, String> -
getFeaturePath(
NavigationStorage storage, String featureKey) → String? -
getModalArgs<
T> (NavigationStorage storage, String modalId) → T? -
go(
GoRouter router, String location, {Map< String, String> queryParameters = const <String, String>{}, Object? extra}) → void -
Accepts query parameters both in
locationand inqueryParameters; the latter take precedence on key collision. -
goNamed(
GoRouter router, String name, {Map< String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, List<String> toggleModals = const <String>[], Object? extra}) → void -
If
modalisn't explicitly inqueryParameters, it's dropped from the current query params (so a modal can be closed by navigating away without re-specifying it).toggleModalstoggles each id: closes it if currently open, opens it otherwise. -
goNamedWithCloseModal(
GoRouter router, String name, {required List< String> modalIds, Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void -
Closes
modalIdsand navigates tonameas a single atomic step. -
goNamedWithModal(
GoRouter router, String name, {required String modalId, Map< String, String> pathParameters = const <String, String>{}, Object? extra}) → void -
goNamedWithOpenModal(
GoRouter router, String name, {required String modalId, Map< String, String> pathParameters = const <String, String>{}, Object? extra}) → void -
Opens
modalIdon the current URI, then navigates tonamekeeping that modal plus any others already open (comma-joined). -
goWithModal(
GoRouter router, String location, {required String modalId, Object? extra}) → void - See goNamedWithOpenModal, for a path instead of a route name.
-
isModalOpen(
GoRouter router, String modalId) → bool -
mergeQueryParametersForGo(
{required Map< String, String> currentQueryParams, required Map<String, String> locationQueryParams, required Map<String, String> newQueryParams}) → Map<String, String> -
Merges, in increasing priority: current query params (minus
modal, same as goNamed sogo()can close a modal on navigation), params parsed from the location string, thennewQueryParams. -
mergeQueryParametersForGoNamed(
{required Map< String, String> currentQueryParams, required Map<String, String> newQueryParams, required List<String> toggleModals, required Uri currentUri}) → Map<String, String> -
mergeQueryParametersForPushNamed(
{required Map< String, String> currentQueryParams, required Map<String, String> newQueryParams}) → Map<String, String> -
openModal(
GoRouter router, String modalId) → void -
Adds
modalIdto themodalquery parameter, comma-joined with any modals already open. -
openModalAsync<
T> (GoRouter router, NavigationStorage storage, String modalId) → Future< T?> -
Opens
modalIdand returns a Future that completes with whatever closeModalWithResult passes when the modal closes (null otherwise). -
openModalAsyncWithArgs<
T> (GoRouter router, NavigationStorage storage, String modalId, dynamic args) → Future< T?> - Like openModalWithArgs, but returns a Future with the close result.
-
openModalInUri(
Uri currentUri, String modalId) → Uri -
openModalWithArgs(
GoRouter router, NavigationStorage storage, String modalId, dynamic args) → void -
Stores
argsin NavigationStorage and opens the modal; readable via getModalArgs, cleared automatically when the modal closes. -
pop(
GoRouter router, {int? level, List< FeatureNavigationConfiguration> ? allFeatures}) → void -
Closes
leveland everything above it. Iflevelis omitted, it's resolved from the current route name (viaallFeatures) or, failing that, from the path depth. -
pushNamed(
GoRouter router, String name, {Map< String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void -
removeModalFromUri(
Uri currentUri) → Uri -
switchToFeature(
GoRouter router, NavigationStorage storage, {required String featureKey, required String defaultPath, String? currentFeatureKey}) → void -
Switches to
featureKey, saving the current URI undercurrentFeatureKey(if given) and restoringfeatureKey's previously saved URI, ordefaultPathif it has none. -
toggleModals(
GoRouter router, List< String> modalIds) → void -
Toggles each id in
modalIds: closes it if open, opens it otherwise. -
toggleModalsInUri(
Uri currentUri, List< String> modalIds) → Uri