Get started
flutter pub add kaiselThe getting started guide takes you from install to
navigating with typed routes in a few minutes — sealed class, exhaustive
switch, done.
原始链接: https://kaisel.dev/
**Kaisel** 是一个为 Flutter 设计的 Dart 3 原生路由库,它将导航视为纯数据,而非基于字符串的路径。通过使用密封类(sealed classes)和穷举式 switch 语句,Kaisel 确保了编译时的安全性,从而消除了运行时的“未知路由”错误。 主要功能包括: * **零代码生成**:无需 `build_runner` 或复杂的配置;路由直接定义为标准的 Dart 类。 * **基于列表的导航**:导航栈被视为路由对象的简单 `List`,使其易于测试和恢复,且无需依赖组件树。 * **统一观察**:通过单一的 `NavigatorObserver` 跟踪所有导航事件,包括自适应更改和标签页切换。 * **简洁性**:通过避免魔法字符串和外部依赖,提供了直接且类型安全的开发体验。 Kaisel 为现有路由库提供了一种精简的替代方案,在支持深度链接、模态流程和自适应布局等复杂模式的同时,保持了完整的类型安全。
Get started
flutter pub add kaiselThe getting started guide takes you from install to
navigating with typed routes in a few minutes — sealed class, exhaustive
switch, done.
Sealed routes, exhaustive builds
Navigation is a switch over a sealed type. Add a route and the compiler
finds every place that must handle it — no runtime “unknown route” left.
The stack is a value
Your history is a List of route objects. Push, pop, and set are list
operations — testable without a widget tree, restorable across process
death.
Every navigation. One observer.
Register a standard NavigatorObserver once — it sees tab switches and
adaptive in-place changes that produce no route event in other routers.
Zero codegen
No build_runner, no generated files, no magic strings. Routes are plain
Dart classes you already know how to write.