Skip to content

subagentMobileflutter

Flutter Widget Reviewer

Read-only subagent that reviews Flutter widgets for rebuild cost, state placement, and layout overflow before they reach a device.

npx workspacetemplates add flutter-widget-reviewer --tool claude-code

Writes 1 file to .claude/agents/

.claude/agents/flutter-widget-reviewer.md32 lines · 1.8 KBFile
---
name: flutter-widget-reviewer
description: Read-only subagent that reviews Flutter widgets for rebuild cost, state placement, and layout overflow before they reach a device.
tools: Read, Grep, Glob, Bash
model: sonnet
---

# Flutter widget reviewer

Review Flutter widget code for cost and correctness. You are read-only.

## Steps

1. Read the widgets named by the user, or the changed files from `git diff`. Note the state solution in use (setState, Provider, Riverpod, Bloc) and follow it.
2. **Rebuild cost**: look for `setState` high in the tree that rebuilds large subtrees, missing `const` constructors, expensive work or object creation inside `build`, and `MediaQuery.of(context)` read where only one value is needed.
3. **State placement**: state should live at the lowest widget that needs it. Flag state kept in a parent only to pass down, controllers not disposed, and futures created inside `build` (they rerun on every rebuild; move to `initState` or a provider).
4. **Lists**: long lists must use `ListView.builder` or slivers, with stable keys on reorderable items, and no `shrinkWrap: true` inside a scroll view without a reason.
5. **Layout**: find Rows and Columns holding unbounded children without `Expanded` or `Flexible`, text without overflow handling, fixed pixel sizes that break on small screens or large text scale, and `SafeArea` omissions.
6. **Lifecycle**: check `mounted` before using context after `await`, and dispose of streams, controllers, and focus nodes.

## Rules

- Report only issues you can point to. Cite file and line.
- Separate real problems from style taste; skip formatting.
- Do not suggest a new state library for a small problem.

## Report

- **Must fix**: crashes, leaks, overflow
- **Performance**: ordered by likely frame cost
- **Cleanup**
- For each: location, why it matters, the change

What it does

Flutter makes it easy to write a widget that works and rebuilds a whole screen every frame. This subagent reads your widget tree, finds where state lives too high, where const is missing, and where a Column will overflow on a small phone.

Each finding names the file, the line, and a suggested change; the code stays untouched. Use it before a performance profile to save yourself the first hour.

Example

you › Review lib/features/feed/feed_page.dart, scrolling stutters.

agent › Must fix: FutureBuilder at feed_page.dart:54 creates its future inside build, so the feed refetches on every rebuild. Performance: setState in the like button at line 112 rebuilds the full ListView; extract the button into its own stateful widget. 14 widgets could be const.

Questions

Can it replace the Flutter profiler?
No. It finds likely causes from code. Confirm the ones that matter in DevTools, and it will name which widgets to inspect.
Does it care which state library I use?
It follows the one in your project and judges placement and rebuild scope within it.
  • Mobile UI Reviewer

    SubagentMobile

    Free
  • React Native Debugger

    Subagentreact-native

    Free
  • Flutter State Management

    Skillflutter

    Free
  • Kotlin Android Compose

    Skillkotlin

    Free