KaiselRoute class abstract
Base marker for application route types.
Apps define their own sealed subclass:
sealed class AppRoute extends KaiselRoute {
const AppRoute();
}
final class Home extends AppRoute {
const Home();
}
final class ProductDetail extends AppRoute {
const ProductDetail(this.id);
final String id;
@override
List<Object?> get props => [id];
}
Equality
KaiselRoute provides default value equality based on props. Two
routes are equal when they have the same runtime type and equal
props. For variants with no fields, the default props (an empty
list) is sufficient — Home() == Home() works out of the box.
For variants with fields, override props:
final class ProductDetail extends AppRoute {
const ProductDetail(this.id);
final String id;
@override
List<Object?> get props => [id];
}
props comparison is per-element using ==. For collection fields
(lists, maps, sets), prefer canonical/const values or override ==
directly with deep-equality logic — props: [tags] on a mutable list
compares by identity, which is rarely what you want.
Subclasses are free to override ==/hashCode directly if they
want different equality semantics; their override wins over the
default.
- Implementers
Constructors
- KaiselRoute()
-
Const constructor so subclasses can be
const.const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
-
props
→ List<
Object?> -
Fields that participate in value equality. Override in variants
that carry data. Defaults to const [] (only runtime type matters).
no setter
- 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 setter - 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