flutter-dart-code-review
Library-agnostic Flutter/Dart code review checklist covering Widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance, accessibility, security, and clean architecture.
Machine translationRead the original Chinese text
库无关的Flutter/Dart代码审查清单,涵盖Widget最佳实践、状态管理模式(BLoC、Riverpod、Provider、GetX、MobX、Signals)、Dart惯用法、性能、可访问性、安全性和整洁架构。
Target: Mobile development. Automatically collected · unverified.
Excerpt from the author’s documentation
Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.
Read the original Chinese text
Topics in the source
- Flutter/Dart 代码审查最佳实践
- 1. 通用项目健康度
- 2. Dart 语言陷阱
- 3. 部件最佳实践
- 部件分解:
- Const 使用:
- Key 使用:
- 主题与设计系统:
适用于审查 Flutter/Dart 应用程序的全面、与库无关的清单。无论使用哪种状态管理方案、路由库或依赖注入框架,这些原则都适用。 \[ ] 项目遵循一致的文件夹结构(功能优先或分层优先) \[ ] 关注点分离得当:UI、业务逻辑、数据层 \[ ] 部件中无业务逻辑;部件纯粹是展示性的 \[ ] pubspec.yaml 是干净的 —— 没有未使用的依赖项,版本已适当固定 \[ ] analysisoptions.yaml 包含严格的 lint 规则集,并启用了严格的分析器设置 \[ ] 生产代码中没有 print() 语句 —— 使用 dart:developer log() 或日志包 \[ ] 生成的文件 (.g.dart, .freezed.dart, .gr.dart) 是最新的或在 .gitignore 中 \[ ] 平台特定代码通过抽象进行隔离 \[ ] 隐式动态类型:缺少类型注解导致 dynamic —— 启用 strict-casts, strict-inference, strict-raw-types \[ ] 空安全误用:过度使用 !(感叹号操作符)而不是适当的空检查或 Dart 3 模式匹配 (if (value case var v?)) \[ ] 类型提升失败:在可以使用局部变量类型提升的地方使用了 this.field \[ ] 捕获范围过宽:catch (e) 没有 on 子句;应始终指定异常类型 \[ ] 捕获 Error:Error 子类型表示错误,不应被捕获 \[ ] 未使用的 async:标记为 async 但从未 await 的函数 —— 不必要的开销 \[ ] late 过度使用:在可使用可空类型或构造函数初始化更安全的地方使用了 late;将错误推迟到运行时 \[ ] 循环中的字符串拼接:使用 StringBuffer 而不是 + 进行迭代式字符串构建 \[ ] const 上下文中的可变状态:const 构造器类中的字段不应是可变的 \[ ] 忽略 Future 返回值:使用 await 或显式调用 unawaited() 来表明意图 \[ ] 在 final 可用时使用 var:局部变量首选 final,编译时常量首选 const \[ ] 相对导入:为保持一致性,使用 package: 导入 \[ ] 暴露可变集合:公共 API 应返回不可修改的视图,而不是原始的 List/Map \[ ] 缺少 Dart 3 模式匹配:优先使用 switch 表达式和 if-case,而不是冗长的 is 检查和手动类型转换 \[ ] 为多重返回值使用一次性类:使用 Dart 3 记录 (String, int) 代替一次性 DTO \[ ] 生产代码中的 print():使用 dart:developer log()
This is an excerpt. Refer to the complete source and its current requirements.
- Source repository
- affaan-m/ECC
- Source file
- docs/zh-CN/skills/flutter-dart-code-review/SKILL.md
- Fixed revision
- d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Sources and evidence
This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.
Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:50.398Z.
Categories are inferred from names, descriptions and paths. They do not establish compatibility.
License and attribution
MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.
Original license ↗Synchronization, copying and user-reported success do not mark a resource as runtime-tested.
Limitations and notes
- Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.