NavigationData class is the core building block for defining routes in NavigationUtils. It encapsulates all the necessary information for a route including the URL pattern, page builder, and optional metadata.
Overview
Each route in your application is defined using aNavigationData instance. This class maps URLs to specific pages and provides configuration options for page transitions, dialogs, and more.
Properties
Optional label for the route, used for named navigation. This allows you to reference routes by name instead of URL, similar to Navigator 1.
The URL pattern for this route. Must start with
/. Supports path parameters using : syntax.Function that builds the widget for this route. Receives three parameters:
context- The build contextrouteData- Route data containing path, query parameters, etc.globalData- Global data associated with the route
The type of page transition to use. Available options:
PageType.material- Material Design page transition (default)PageType.transparent- Transparent page transitionPageType.cupertino- iOS-style page transition
Whether this route should be displayed as a fullscreen dialog. When
true, the page will be presented modally.The barrier color for modal routes. Only applies when using transparent page type.
Optional metadata associated with this route. Useful for route guards, analytics, or custom logic.
Optional custom page builder for this route. If provided, this takes precedence over the default page building logic.
Routes can be grouped together by setting a common
group name. By default, Flutter identifies routes with unique URLs as unique pages. Setting a group alias overrides this behavior and identifies those routes as the same page.This is particularly useful for tab navigation where multiple URLs should reuse the same widget instance.Computed properties
The parsed URI from the
url property.The canonical path from the
url, without query parameters.The query parameters extracted from the
url.Usage examples
Basic route
Named route with query parameters
Route with path parameters
Grouped routes for tab navigation
All three routes share the same widget instance due to the common
group value. Navigating between tabs updates the widget instead of recreating it.Route with custom page type
Route with metadata for guards
Type definitions
NavigationPageFactory
CustomPageBuilder
Page objects with full control over the page configuration.