flutter-dart-style
Write modern, concise, idiomatic Dart 3.13 / Flutter 3.47 code - primary constructors, private named parameters, dot shorthands, null-aware elements, patterns and sealed classes, records, extension types, widget-class conventions, const, lints (very_good_analysis/flutter_lints), Effective Dart naming. Use this whenever writing or refactoring any Dart/Flutter code, generating widgets, models or classes, reviewing code style, or when code looks verbose, outdated (pre-Dart-3) or full of `!` and if/else chains - apply it by default to all Flutter code you write.
原文 · 译文尚未补齐适用对象:移动应用开发。自动收录 · 待核查。
原作者说明节选
从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。
查看英文原文
原文涵盖的主题
- Modern Dart & Flutter code style
- 1. Classes & models
- 2. Null safety & control flow
- 3. Widgets
- 4. Naming & structure (Effective Dart)
- 5. Errors & logging
- 6. Lints & tooling (set up once, then trust them)
- 7. Deprecated APIs
Verified 2026-09-25: Flutter 3.47.5 / Dart 3.13.4 (stable). Language features depend on the package's SDK constraint. Check environment: sdk: in pubspec.yaml before using a feature. The minimum language version is noted on each item below. Goal: less code, same behavior, and mistakes caught by the compiler instead of at runtime. Don't write code the SDK, the language, or an existing dependency already provides. Primary constructors (3.13) declare fields and constructor in the header: Widgets too (compile-checked): var/final in the header creates a field. Without it, the parameter is just a parameter. Since 3.13, final/var on ordinary function parameters is a compile error. Concise constructors (3.13) in class bodies: new(this.x, this.y);, new origin() : x = 0, y = 0;, factory fromJson(Map j) => ...;, const new();. Private named parameters (3.12): Point({required this.x}) is called as Point(x: 1). Before 3.13, the equivalent is const Point({required this.x, required this.y}); final int x; final int y;. Immutable by default: final fields, const constructors, copyWith via codegen (freezed/dartmappable) only when you need it. Sealed hierarchies for states/results/events. switch is exha
这里只展示节选,请以完整原文和当前要求为准。
- 来源仓库
- abugeek/flutter-skills
- 源文件
- .claude/skills/flutter-dart-style/SKILL.md
- 固定版本
- 458377635834ad1cff2c4871ac0725a5ef4bcd4f
来源与内容状态
本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。
原作者:abugeek/flutter-skills · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-10T09:01:53.908Z。
分类由名称、说明与路径规则生成,分类不代表已核实适配。
许可与权利归属
MIT。第三方内容及版权归原作者,使用条件以原文为准。
许可原文 ↗本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。
限制与注意事项
- 元数据收录不代表本站已经安装、适配、实测或进行安全审查。