ContextNavigationExtensions extension

Navigation helpers on BuildContext that preserve the current query parameters, extra, and fragment across calls.

on

Properties

canCollapseMobileLevel3 → bool

Available on BuildContext, provided by the ContextNavigationExtensions extension

no setter
canCollapseMobileLevel4 → bool

Available on BuildContext, provided by the ContextNavigationExtensions extension

no setter
canToggleLevel2 → bool

Available on BuildContext, provided by the ContextNavigationExtensions extension

True when level2 is part of the current layout and there's real content (level3/level4) next to it to collapse it against.
no setter
currentExtra → Object?

Available on BuildContext, provided by the ContextNavigationExtensions extension

no setter
currentFragment → String

Available on BuildContext, provided by the ContextNavigationExtensions extension

no setter
currentQueryParameters → Map<String, String>

Available on BuildContext, provided by the ContextNavigationExtensions extension

no setter
isLevel3MobileCollapsed → bool

Available on BuildContext, provided by the ContextNavigationExtensions extension

Uses watch, so the widget rebuilds when this changes.
no setter
isLevel4MobileCollapsed → bool

Available on BuildContext, provided by the ContextNavigationExtensions extension

no setter
multilevelLayoutState → MultilevelLayoutRule

Available on BuildContext, provided by the ContextNavigationExtensions extension

Uses watch — call only from a widget below MultilevelNavigatorProvider.
no setter
multilevelLayoutStateOnce → MultilevelLayoutRule

Available on BuildContext, provided by the ContextNavigationExtensions extension

One-shot read (no rebuild on change) — call only from a widget below MultilevelNavigatorProvider.
no setter

Methods

closeAllModals({BuildContext? context}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

closeModal(String modalId, {BuildContext? context}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Removes modalId from the modal query parameter, dropping the parameter entirely if it was the last one open.
closeModalAsync(String modalId, {BuildContext? context}) → Future<void>

Available on BuildContext, provided by the ContextNavigationExtensions extension

Async version of closeModal — await it before navigating further to guarantee the router has already updated.
closeModalWithResult<T>(String modalId, T? result, {BuildContext? context}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Closes modalId, completing the Future from a matching openModalAsync.
collapseLevel2() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

collapseMobileLevel3() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Collapses level3 on mobile, revealing level2. With MobileLevelCollapseMode.preserve (the default) level3 stays mounted and its state survives; with MobileLevelCollapseMode.discard this is equivalent to context.pop(level: 3).
collapseMobileLevel4() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

See collapseMobileLevel3.
expandLevel2() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

expandMobileLevel3() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

expandMobileLevel4() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

go(String location, {Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Accepts query parameters both in location and in queryParameters; the latter take precedence on key collision.
goNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, List<String> toggleModals = const <String>[], Object? extra}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

goNamedWithCloseModal(String name, {required List<String> modalIds, Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Closes modalIds and navigates to name as a single atomic step.
goNamedWithModal(String name, {required String modalId, Map<String, String> pathParameters = const <String, String>{}, Object? extra}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Adds modal to the query parameters for name.
goWithModal(String location, {required String modalId, Object? extra}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Adds modal to the query parameters for location.
isModalOpen(String modalId) → bool

Available on BuildContext, provided by the ContextNavigationExtensions extension

openModal(String modalId, {BuildContext? context}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Opens modalId on the current path. Multiple modals are comma-joined in the modal query parameter.
openModalAsync<T>(String modalId, {BuildContext? context}) → Future<T?>

Available on BuildContext, provided by the ContextNavigationExtensions extension

Opens modalId and returns a Future that completes with whatever closeModalWithResult passes when the modal closes (null otherwise).
openModalAsyncWithArgs<T>(String modalId, dynamic args, {BuildContext? context}) → Future<T?>

Available on BuildContext, provided by the ContextNavigationExtensions extension

Like openModalWithArgs, but returns a Future with the close result.
openModalInstance(MultilevelModalBuilderAbstraction builder) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Opens a modal via a builder instance instead of the registered singleton (pattern A: constructor params). The builder is stashed as a one-shot override and cleared automatically when the modal closes — it doesn't need to be pre-registered in MultilevelModalManager.
openModalInstanceAsync<T>(MultilevelModalBuilderAbstraction builder) → Future<T?>

Available on BuildContext, provided by the ContextNavigationExtensions extension

Like openModalInstance, but returns a Future compatible with closeModalWithResult.
openModalWithArgs(String modalId, dynamic args, {BuildContext? context}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Opens modalId with arbitrary args (pattern B), readable inside the builder via readModalArgs. Cleared automatically when the modal closes.
pop({int? level}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Closes level and everything above it. If level is omitted it's resolved from the current route name.
pushNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

readModalArgs<T>(String modalId) → T?

Available on BuildContext, provided by the ContextNavigationExtensions extension

Reads args passed via openModalWithArgs, for use inside a modal builder.
switchToFeature(FeatureNavigationConfiguration feature) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Switches to feature, saving the current URI so it can be restored when this feature is switched back to.
toggleLevel2() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

toggleMobileLevel3() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

toggleMobileLevel4() → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

toggleModals(List<String> modalIds, {BuildContext? context}) → void

Available on BuildContext, provided by the ContextNavigationExtensions extension

Toggles each id in modalIds: closes it if open, opens it otherwise.