KaiselModalRoute<T> class
abstract
Marker interface for routes that present a modal sub-flow returning
a value of type T.
Implement this alongside your sealed route hierarchy — a modal
route is still part of AppRoute, but also carries the result type
for await router.run<T>(...):
sealed class AppRoute extends KaiselRoute {
const AppRoute();
}
final class ConfirmPurchase extends AppRoute
implements KaiselModalRoute<bool> {
const ConfirmPurchase(this.productId);
final String productId;
@override
List<Object?> get props => [productId];
}
// Elsewhere:
final bool? confirmed = await router.run(ConfirmPurchase('sku-42'));
Inside the flow's screens, call context.completeFlow<bool>(true)
(or false, or null to cancel) to resolve the awaited future and
dismiss the modal.
- Inheritance
-
- Object
- KaiselRoute
- KaiselModalRoute
Constructors
- KaiselModalRoute()
-
Const constructor so subclasses can be
const.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
props
→ List<
Object?> -
Fields that participate in value equality. Override in variants
that carry data. Defaults to const [] (only runtime type matters).
no setterinherited
- restorationId → String?
-
Stable id set as the page's
restorationId, so the page's inner widget state (scroll, text fields viaRestorationMixin) survives process death. Defaults to routeName for parameterless routes andnullfor routes with props (whose instances would otherwise share a bucket) — override with a param-aware id like'product-$id'to opt those in.no setterinherited - routeName → String
-
Name set as
RouteSettings.nameon the page kaisel builds, soNavigatorObservers can identify the screen viaroute.settings.name. Defaults to the runtime type name; override for a custom (or obfuscation-stable) one.no setterinherited - 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