fluro_router_generate 1.4.2
fluro_router_generate: ^1.4.2 copied to clipboard
A powerful Flutter library for routing based on Fluro, featuring annotations and code generation, with animated transitions, route matching, and support for custom navigation.
Changelog / 更新日志 #
1.4.2 #
English
FluroRouter.pop/popToRoot/popUntil: Align with [Navigator] APIs—optionalrootNavigatoron all three;popUntilmatches [Navigator.popUntil] (removed the unused positionalresultargument that was never forwarded).popToRootis equivalent topopUntiluntilroute.isFirst.popuses namedresult(callpop(context, result: value)instead of a second positional argument).FluroConfig:pop,popToRoot,popUntilmirror the router methods, using optionalcontextor configuredcurrentContext(same rule aspush).- CI: Pre-generate
examplerouter code (flutter pub get+dart run build_runner build --delete-conflicting-outputsinsideexample/) beforeflutter test, sodeferred_generation_regression_test.dartcan read the*.router.g.dartfiles that are excluded by.gitignore.testandpublishjobs are aligned; triggerpathsnow also includeexample/**and.github/workflows/**. - Static analysis:
dart analyze --fatal-warnings --fatal-infosis clean. Closures that bound a function to a name now use a function declaration (route_strategy.dart:NativeRouteStrategy/MaterialRouteStrategy/CupertinoRouteStrategy/CustomRouteStrategy/SimpleTransitionStrategy),fluro_router_gen.dartadds braces to a single-statementif, and theexampleauthGuard2post-awaitcontextuse is annotated likeauthGuard1.
中文
FluroRouter.pop/popToRoot/popUntil:与 [Navigator] 对齐,三者均支持可选rootNavigator;popUntil与 [Navigator.popUntil] 一致,并移除原先未实际传入 Navigator 的无用result位置参数。popToRoot等价于一直popUntil到route.isFirst。pop的返回值改为命名参数result(写成pop(context, result: value),勿再用第二位位置参数)。FluroConfig:新增pop、popToRoot、popUntil,与路由器方法对应;context可省略时使用已配置的currentContext(与push相同)。- CI:在
flutter test之前先在example/内执行flutter pub get与dart run build_runner build --delete-conflicting-outputs,预生成.router.g.dart(这些文件被.gitignore排除),修复 CI 上deferred_generation_regression_test.dart因找不到生成文件而失败的问题;test/publish两个 job 步骤对齐;触发paths增加example/**与.github/workflows/**。 - 静态分析:
dart analyze --fatal-warnings --fatal-infos零告警。route_strategy.dart中NativeRouteStrategy/MaterialRouteStrategy/CupertinoRouteStrategy/CustomRouteStrategy/SimpleTransitionStrategy的局部闭包改为函数声明;fluro_router_gen.dart单语句if补花括号;example中authGuard2的await后context使用与authGuard1对齐。
1.4.1 #
English
- FluroConfig.push: Forwards
disableSwipeBacktoFluroRouter.navigateTo(previously omitted, so the flag had no effect when using generated push). - disableSwipeBack: When
true, uses routes that setpopGestureEnabledtofalseso iOS edge swipe-back onMaterialPageRoute/CupertinoPageRoute/ customPageRouteBuilderis disabled alongsideSwipeBackWrapper. - Preset transitions (
inFromRight, etc.):SimpleTransitionStrategydefaultsPageRouteBuilder.opaquetofalse(was incorrectly opaque in debug builds), so slide transitions can show the underlying route as intended. - Docs / DX: Clarified
disableSwipeBackonFluroRouteDataandFluroConfig.push; fixed typo in the missing-context exception (FiuroConfig→FluroConfig).
中文
- FluroConfig.push:将
disableSwipeBack透传给FluroRouter.navigateTo(此前未传递,生成式 push 时该开关不生效)。 - disableSwipeBack:为
true时使用popGestureEnabled == false的路由子类,在关闭SwipeBackWrapper的同时禁用 iOS 上 Material/Cupertino/自定义PageRouteBuilder的左缘返回手势。 - 预设转场(如
inFromRight):SimpleTransitionStrategy默认PageRouteBuilder.opaque为false(此前在 debug 下错误地为不透明),侧滑/转场时可露出下层页面。 - 文档与体验:补充
FluroRouteData、FluroConfig.push上disableSwipeBack说明;修正未设置 context 时异常文案拼写(FiuroConfig→FluroConfig)。
1.4.0 #
English
- Disable swipe-back wrapper: New
disableSwipeBack(defaultfalse) onFluroRouter.define,navigateTo,FluroConfig.push, andmatchRoute. Whentrue, preset transitions (inFromLeft/fadeIn/none, etc.) no longer wrap withSwipeBackWrapper. Route-level and per-push flags are OR’d; guard suspend/resume preserves the flag viaPendingNavigation. - Deferred route UX:
DeferredRoutePagesupports optionalwrapperfor customFutureBuilder/animations;DeferredRouteUIOptionsandFluroConfig.deferredWrapperFor(path)for global/per-path wiring;registerDeferredLoader/preloadDeferredRoute/preloadAllDeferredRoutesfor preloading large deferred modules.
中文
- 禁用侧滑返回包装:新增
disableSwipeBack(默认false),可在FluroRouter.define、navigateTo、FluroConfig.push、matchRoute使用。为true时,inFromLeft/fadeIn/none等预设转场不再包SwipeBackWrapper。路由定义与单次跳转任一为true即禁用;守卫挂起/恢复通过PendingNavigation保留该参数。 - Deferred 路由体验:
DeferredRoutePage支持可选wrapper自定义 FutureBuilder/动画;DeferredRouteUIOptions与FluroConfig.deferredWrapperFor(path)做全局/按路径配置;registerDeferredLoader、preloadDeferredRoute、preloadAllDeferredRoutes用于大模块预加载。
1.3.1 #
English
- Deferred Components: Support
RouteLoadMode.deferredin@RouterAnnotation. Generator emitsimport ... deferred as ...,loadLibrary(), andDeferredRoutePage. OptionaldeferredGroupanddeferredComponentfor grouping and Android deferred-components mapping. - Deferred UI config: Global and per-path loading/error UI for deferred routes via
FluroConfig.deferredRouteUIOptionsandFluroConfig.setDeferredBuildersForPath(path, loading: ..., error: ...). Generated code callsFluroConfig.deferredLoadingBuilderFor(path)andFluroConfig.deferredErrorBuilderFor(path)so custom builders apply when set. - Build config: Optional
default_load_mode: eager|deferredin builderoptionsfor global default. - Docs: README/README_zh and example updated with full Deferred Components flow (Dart + Android
pubspec.yaml), and FluroConfig deferred UI usage.
中文
- Deferred Components:
@RouterAnnotation支持RouteLoadMode.deferred。生成器产出import ... deferred as ...、loadLibrary()与DeferredRoutePage。可选deferredGroup、deferredComponent用于分组及 Android 动态组件映射。 - Deferred 加载/失败 UI 配置:通过
FluroConfig.deferredRouteUIOptions设置全局默认,通过FluroConfig.setDeferredBuildersForPath(path, loading: ..., error: ...)按路径覆盖。生成代码会使用FluroConfig.deferredLoadingBuilderFor(path)与FluroConfig.deferredErrorBuilderFor(path),配置后即生效。 - 构建配置:builder 的
options支持default_load_mode: eager|deferred作为全局默认。 - 文档:README/README_zh 与 example 补充完整 Deferred Components 流程(Dart + Android
pubspec.yaml)及 FluroConfig deferred UI 用法。
1.2.0 #
English
- Breaking: Generated file suffix changed from
.g.dartto.router.g.dartto avoid output collision withsource_gen:combining_builder(e.g. when using json_serializable, freezed in the same project). Update your route entry toexport 'router_config.router.g.dart';and rundart run build_runner build --delete-conflicting-outputs.
中文
- 破坏性变更:生成文件后缀由
.g.dart改为.router.g.dart,避免与source_gen:combining_builder输出冲突(如项目内同时使用 json_serializable、freezed)。请将路由入口改为export 'router_config.router.g.dart';并执行dart run build_runner build --delete-conflicting-outputs。
1.1.3 #
English
- Route guard suspend: Hang navigation with [Completer]; call [FluroConfig.resumePendingRoute] to continue (with correct return value) or [FluroConfig.clearPendingRoute] to end. Supports multiple guards and multiple suspend/resume rounds.
- Fix:
Future<dynamic>is no longer cast toFuture<T?>; use.then<T?>((v) => v as T?)sopush<T>returns the correct type and avoids runtime cast errors. - Docs: Removed business-specific wording from
lib/srccomments; kept only API/mechanism descriptions.
中文
- 路由守卫挂起:使用 [Completer] 挂起本次跳转的 Future;通过 [FluroConfig.resumePendingRoute] 恢复(可正确带回返回值)或 [FluroConfig.clearPendingRoute] 结束。支持多守卫、多轮挂起/恢复。
- 修复:不再将
Future<dynamic>强转为Future<T?>,改为.then<T?>((v) => v as T?),避免push<T>运行时类型转换错误。 - 文档:去除
lib/src中业务相关注释,仅保留 API/机制说明。
1.1.2 #
English
- Pub & conventions: CHANGELOG entries for 1.1.1 and 1.1.2; package ready for clean publish.
- Static analysis: Removed redundant package import in
lib/src/fluro_router.dart(use relative import forroute_guard.dart). - Dependencies: Relaxed
analyzerconstraint to>=8.0.0 <11.0.0so the package supports current stable (e.g. 9.x, 10.x) and improves pub score.
中文
- Pub 与规范:补全 1.1.1、1.1.2 的 CHANGELOG,便于在干净 git 状态下发布。
- 静态分析:移除
lib/src/fluro_router.dart中多余包导入,改为相对导入route_guard.dart。 - 依赖:将
analyzer约束放宽为>=8.0.0 <11.0.0,支持当前稳定版(如 9.x、10.x),提升 pub 评分。
1.1.1 #
English
- Maintenance release; dependency and tooling updates.
中文
- 维护版本;依赖与工具链更新。
1.1.0 #
English
- Route guards: Run logic before
Navigator.pushto allow, redirect, or cancel navigation (unlikeNavigatorObserver, which only runs after push/pop). - Guard API:
FluroConfig.addGuard(guard),insertGuard(index, guard),removeGuard(guard),clearGuards(). - Guard result:
GuardResult.allow,GuardResult.redirect(newPath),GuardResult.cancel; redirect is capped at 5 hops to avoid loops. - Context:
RouteGuardContextprovidespath,context,replace,clearStack,routeMatch, etc. for guard decisions.
中文
- 路由守卫:在每次跳转执行 [Navigator.push] 之前执行守卫,可放行、重定向或取消(与仅能事后回调的 [NavigatorObserver] 互补)。
- 守卫 API:
FluroConfig.addGuard(guard)、insertGuard(index, guard)、removeGuard(guard)、clearGuards()。 - 守卫结果:
GuardResult.allow、GuardResult.redirect(newPath)、GuardResult.cancel;重定向最多 5 次以防死循环。 - 上下文:
RouteGuardContext提供path、context、replace、clearStack、routeMatch等供守卫判断。
1.0.0 #
English
- Initial release.
- Fluro-based routing with annotations and code generation.
- Path params, query params, and
RouteSettings.argumentssupport. - Animated transitions and custom navigation.
中文
- 初始版本发布。
- 基于 Fluro 的注解 + 代码生成路由。
- 支持路径参数、查询参数、RouteSettings.arguments 传参。
- 支持动画转场与自定义导航。