flutter_errors — Claude Code rule for Flutter errors and setup
This rule connects common Flutter errors to likely layout or state-management causes. Use it when a widget tree fails with overflow, sizing, or build-phase issues.
MIT ★ 674 updated 2026-10-29
/plugin marketplace add evanca/flutter-ai-rules
/plugin install flutter-ai-skills@flutter-ai-rulesWhat flutter_errors does
The rule maps Flutter error messages to checks in the widget tree. For RenderFlex overflowed, it points to unconstrained children in a Row or Column and suggests adding Flexible, Expanded, or explicit constraints. A scrollable widget inside a Column needs a height bound; a TextField may need its width constrained. It also warns against calling setState or showDialog directly from build.
Other cases include a ScrollController shared by multiple scroll views and RenderBox was not laid out. The guidance recommends inspecting widget constraints with Flutter Inspector. Calling setState during build is a direct trigger for one of the errors covered here.
What it helps with
- trace overflow in a
RoworColumn - bound a
ListViewinside aColumn - constrain a
TextFieldwidth - move
setStateout ofbuild - stop sharing one
ScrollControlleracross scroll views
Example prompts for the agent
- Find the cause of
RenderFlex overflowedin thisRowand suggest a fix. - Explain why this
ListViewinside aColumnhas unbounded height. - Check this widget for a
setState called during builderror.
How to install flutter_errors
1Plugin marketplace
/plugin marketplace add evanca/flutter-ai-rules/plugin install flutter-ai-skills@flutter-ai-rules2Manually: put the files in place
.claude/rules/flutter_errors.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/flutter_errors.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/flutter_errors.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/flutter_errors.mdManually: put the files in place
.clinerules/flutter_errors.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about flutter_errors
How do I install flutter_errors in Claude Code?
Run these commands in order: /plugin marketplace add evanca/flutter-ai-rules, then /plugin install flutter-ai-skills@flutter-ai-rules. The rule file path is .claude/rules/flutter_errors.md.
What does flutter_errors do?
It links common Flutter errors to likely causes involving layout constraints, scrolling, and state changes during the build phase.
How does it address an unbounded-height error?
For a ListView or similar scrollable inside a Column, the rule recommends giving it a height bound, such as with Expanded or SizedBox.
Source text
flutter_errors.md · MIT
### Common Flutter Errors 1. If you get a "RenderFlex overflowed" error, check if a `Row` or `Column` contains unconstrained widgets. Fix by wrapping children in `Flexible`, `Expanded`, or by setting constraints. 2. If you get "Vertical viewport was given unbounded height", ensure `ListView` or similar scrollable widgets inside a `Column` have a bounded height (e.g., wrap with `Expanded` or `SizedBox`). 3. If you get "An InputDecorator...cannot have an unbounded width", constrain the width of widgets like `TextField` using `Expanded`, `SizedBox`, or by placing them in a parent with width constraints. 4. If you get a "setState called during build" error, do not call `setState` or `showDialog` directly inside the build method. Trigger dialogs or state changes in response to user actions or after the build completes (e.g., using `addPostFrameCallback`). 5. If you get "The ScrollController is attached to multiple scroll views", make sure each `ScrollController` is only attached to a single scrollable widget at a time. 6. If you get a "RenderBox was not laid out" error, check for missing or unbounded constraints in your widget tree. This is often caused by using widgets like `ListView` or `Column` without proper size constraints. 7. Use the Flutter Inspector and review widget constraints to debug layout issues. Refer to the official documentation on constraints if needed.
© Ivanna Kaceviča · MIT · evanca/flutter-ai-rules