Route class final
A route represents a page or screen in the application with configurable regions and lifecycle handlers.
Routes can be:
- Pages with different layouts (default, tabs, single item)
- Dialog routes for modal content
- Conditional routes that adapt based on conditions
Example:
final route = Route(
title: 'Home',
routeType: PageRouteType(),
path: '/home',
regions: [
Region(
identifier: 'body',
title: 'Body',
items: [myCard, myGroup],
),
],
createdAt: DateTime.now(),
updatedAt: DateTime.now(),
id: 'home-route',
);
- Inheritance
-
- Object
- ContentItem
- RouteBase
- Route
- Available extensions
- Annotations
-
- @JsonSerializable()
Constructors
-
Route.new({required String title, required RouteTypeConfiguration? routeType, required String path, required List<
Region> regions, required DateTime createdAt, required DateTime updatedAt, required String id, Category? category, LayoutConfiguration<ContentItem> ? layout, List<ContentModifierConfiguration> ? modifiers, List<RouteLifecycleConfiguration> ? lifecycleHandlers}) -
Route.fromJson(Map<
String, dynamic> json) -
factory
Properties
- category → Category?
-
Optional category for organizing routes.
finalinherited
- createdAt → DateTime
-
When this route was created in the CMS.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier for this route.
finalinherited
-
layout
→ LayoutConfiguration<
ContentItem> ? -
The layout configuration for the content item.
finalinherited
-
lifecycleHandlers
→ List<
RouteLifecycleConfiguration> ? -
final
-
modifiers
→ List<
ContentModifierConfiguration> ? -
finalinherited
- parent ↔ ContentItem?
-
The parent content item of this content item. This is used internally by the content system.
getter/setter pairinherited
- path → String
-
The URL path for this route.
This is used to match URLs and generate links.
finalinherited
-
regions
→ List<
Region> -
final
- routeType → RouteTypeConfiguration?
-
Configuration for how this route should be presented.
Defines transitions, animations, and other route-specific behavior.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schemaType → String
-
The schema type of the content item.
finalinherited
- title → String
-
The title of the route, displayed in navigation UI.
finalinherited
- updatedAt → DateTime
-
When this route was last updated in the CMS.
finalinherited
Methods
-
createPage<
T> (BuildContext context, [LocalKey? pageKey]) → Page< T> -
Create a Flutter page for this route.
inherited
-
dispose(
) → Future< void> -
Clean up the route when it is no longer active.
override
-
getLayout(
) → LayoutConfiguration< ContentItem> ? -
Gets the layout to use for the
ContentItem
. By default its the layout itself. However this acts as an extension point for customContentItem
s that may have a different strategy for applying layouts.inherited -
getModifiers(
) → List< ContentModifierConfiguration> ? -
Gets the modifiers to use for the
ContentItem
. By default its the modifiers itself. However this acts as an extension point for customContentItem
s that may have a different strategy for applying modifiers.inherited -
init(
BuildContext context) → Future< RouteBase?> -
Initialize the route when it becomes active.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
regionItems(
String regionName) → List< ContentItem> -
Available on Route, provided by the RegionItems extension
-
setParent(
Iterable< ContentItem?> children) → void -
Sets the parent content item for the given list of children.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- contentBuilder → _RouteContentBuilder
-
final
-
typeDescriptor
→ TypeDescriptor<
Route> -
final
Static Methods
-
lifecycleHandlersFromJson(
dynamic json) → List< RouteLifecycleConfiguration> ?
Constants
- schemaName → const String