Kaisel – 将路由作为值。Flutter 的 Dart 3 原生路由器
Kaisel – Routes as Values. Dart 3 Native Router for Flutter

原始链接: https://kaisel.dev/

**Kaisel** 是一个为 Flutter 设计的 Dart 3 原生路由库,它将导航视为纯数据,而非基于字符串的路径。通过使用密封类(sealed classes)和穷举式 switch 语句,Kaisel 确保了编译时的安全性,从而消除了运行时的“未知路由”错误。 主要功能包括: * **零代码生成**:无需 `build_runner` 或复杂的配置;路由直接定义为标准的 Dart 类。 * **基于列表的导航**:导航栈被视为路由对象的简单 `List`,使其易于测试和恢复,且无需依赖组件树。 * **统一观察**:通过单一的 `NavigatorObserver` 跟踪所有导航事件,包括自适应更改和标签页切换。 * **简洁性**:通过避免魔法字符串和外部依赖,提供了直接且类型安全的开发体验。 Kaisel 为现有路由库提供了一种精简的替代方案,在支持深度链接、模态流程和自适应布局等复杂模式的同时,保持了完整的类型安全。

```Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Kaisel – 将路由作为值。Flutter 的 Dart 3 原生路由 (kaisel.dev) 14 点,由 TheWiggles 发布于 45 分钟前 | 隐藏 | 过往 | 收藏 | 讨论 帮助 考虑申请 YC 2026 年秋季批次!申请截止日期为 7 月 27 日。 准则 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:```
相关文章

原文
Skip to content
The idea behind kaisel — Flutter Routes as Values →

kaisel

Routes as values. A Dart 3-native router for Flutter — no string paths, no codegen.

Get started

Terminal window
flutter pub add kaisel

The 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.

联系我们 contact @ memedata.com