KaiselConfig<R extends KaiselRoute> class

The configuration that flows between the URL bar and the router.

The Flutter Router widget asks the delegate for a configuration (to update the browser URL) and hands one back when a URL changes (to restore in-app state). The configuration describes the main router's stack plus an optional nested-router state — whichever nested router (shell or module) is currently on top of the main stack.

// URL  →  KaiselConfig
//   /home/products/sku-42
//   ↓
//   KaiselConfig(
//     mainStack: [MainShell()],
//     nestedState: KaiselShellConfig(
//       activeBranch: 0,
//       activeBranchStack: [HomeRoot(), ProductDetail('sku-42')],
//     ),
//   )
//
//   /checkout/confirm
//   ↓
//   KaiselConfig(
//     mainStack: [CheckoutMount()],
//     nestedState: KaiselModuleConfig(
//       stack: [CheckoutCart(), CheckoutShipping(), CheckoutConfirm()],
//     ),
//   )

Only one nested router can be on top of the main stack at a time, so nestedState is a sealed KaiselNestedConfig — at most one kind, statically enforced.

Annotations
  • @immutable

Constructors

KaiselConfig({required List<R> mainStack, KaiselNestedConfig? nestedState})
Create a configuration with a main stack and optional nested state (shell or module).
KaiselConfig.stackOnly(List<R> stack)
Convenience for migration: a config with just a stack.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
mainStack List<R>
The main router's stack — the outer navigation history.
final
nestedState KaiselNestedConfig?
State of the currently-mounted nested router (shell or module), if any. null when no nested router is on top, or when the codec didn't bother to describe it.
final
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.
override

Operators

operator ==(Object other) bool
The equality operator.
override