Write, review, or refactor idiomatic Flutter code. Use for widgets, state and architecture, lifecycle, layout, theming, accessibility, performance, and tests. Apply alongside the write-dart skill for Dart guidance.
81%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Produce Flutter code that is composable, correct across rebuilds, efficient, and accessible.
This skill builds on the write-dart skill:
apply that skill's Dart guidance,
then add the Flutter-specific guidance here.
In the references, DO and DON'T are near-absolute,
PREFER and AVOID are strong defaults,
and CONSIDER requires judgment.
analysis_options.yaml.setState, ChangeNotifier, provider, or Riverpod,
and match its approach for shared state.
Local setState can coexist with an app-level state solution.
Don't add a second package or competing architecture for shared state
without a concrete requirement.Apply these high-frequency Flutter rules alongside write-dart.
_buildHeader() helper.
Widget classes can be const, appear by name in DevTools and error messages,
limit rebuild scope, and support independent tests.const constructors,
and use const at creation sites wherever possible.
Reusing the same widget instance lets Flutter
stop the update traversal at that widget.build free of side effects and unnecessary work.
The build method can run every frame.
Don't perform side effects, start requests,
or create futures, controllers, and other objects with identity.StatelessWidget.
When something genuinely changes over time, add state.State owns,
and cancel subscriptions that it creates.
Don't dispose objects supplied by a parent unless ownership was transferred.mounted in a State or context.mounted for a BuildContext
before calling setState, using the context,
or doing other work that requires the State to remain in the tree.
The use_build_context_synchronously lint flags violations.FutureBuilder and StreamBuilder,
obtain futures and streams before build,
such as in initState, didUpdateWidget, or didChangeDependencies.
Refresh them when the inputs change.
Creating them inline in build can restart work on every rebuild.Column or Row bounded space,
usually with Expanded.
Use spacing for uniform main-axis gaps.Theme.of(context) for Material
or CupertinoTheme.of(context) for Cupertino.
Avoid duplicating visual constants at use sites.maxLines and overflow behavior deliberately..builder constructors for long or unbounded lists.const, extracted widgets,
and the child parameter of ListenableBuilder and AnimatedBuilder
for static subtrees.Extend the write-dart validation loop with Flutter tools.
When the environment allows it,
run the app and exercise the changed UI.
Check the console for overflow errors, exceptions,
and setState() called after dispose() warnings that analysis can't catch.
Read only the references relevant to the code you're writing or reviewing:
flutter/website
3667d0e
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.