NavigatorCompatibilityOverrides class final

Central component of the compatibility layer that adapts Navigator 1.0 operations for use with YxNavigation's declarative architecture.

Purpose

Enables seamless integration of legacy Navigator 1.0 code (pageless routes) with YxNavigation (page-based routes) by:

  1. Intercepting Navigator 1.0 operations (push, pop, pushReplacement, etc.)
  2. Wrapping pageless routes in Page objects
  3. Synchronizing route state with RouteNode tree
  4. Managing route result Completers for proper async behavior

Supported Operations

  • push - Creates new pageless route
  • pop - Closes route and returns result
  • pushReplacement - Replaces current route
  • pushAndRemoveUntil - Clears stack with predicate
  • removeRoute - Removes specific route from stack

Supported Route Types

Out of the box support:

Custom routes via CustomRoutePageFactoryResolver.

Features

Observer

Register a CompatibilityObserver to monitor pageless route lifecycle events for analytics, debugging, or migration tracking.

Usage

Register with NavigationConfigProvider:

NavigationConfigProvider(
  navigatorOverrides: NavigatorCompatibilityOverrides(
    // Optional: custom route resolver
    customRoutePageFactoryResolver: MyCustomResolver(),

    // Optional: observer for analytics/debugging
    observer: MyCompatibilityObserver(),
  ),
  child: MaterialApp.router(routerConfig: config),
)

See also:

Inheritance

Constructors

Central component of the compatibility layer that adapts Navigator 1.0 operations for use with YxNavigation's declarative architecture.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
observer CompatibilityObserver?
Observer for pageless route lifecycle events.
finalinherited
pop PopOperation?
Custom implementation of Navigator.pop.
no setteroverride
push PushOperation?
Custom implementation of Navigator.push.
no setteroverride
pushAndRemoveUntil PushAndRemoveUntilOperation?
Custom implementation of Navigator.pushAndRemoveUntil.
no setteroverride
pushReplacement PushReplacementOperation?
Custom implementation of Navigator.pushReplacement.
no setteroverride
removeRoute RemoveRouteOperation?
Custom implementation of Navigator.removeRoute.
no setteroverride
routeIdGenerator RouteIdGenerator
Generator for stable pageless route identifiers.
finalinherited
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

Constants

argumentsExtraKey → const String
Key for storing route arguments in RouteNode.extra.
completerExtraKey → const String
Key for storing result Completer in RouteNode.extra.
pageFactoryExtraKey → const String
Key for storing Page in RouteNode.extra.
routeExtraKey → const String
Key for storing original Route in RouteNode.extra.
routeIdExtraKey → const String
Key for storing route ID in RouteNode.extra.