Profile Performance
Measure performance in the right mode on representative hardware.
Build Modes
| Mode | Use for | Do not use for |
|---|---|---|
| Debug | Hot reload, development, assertions | Performance claims |
| Profile | Performance measurement and DevTools profiling | Store release |
| Release | Deployment artifact, startup/size/speed validation | Debugging development issues |
Workflow
flutter run --profile -d <device-id>
flutter build apk --release
flutter build web --release
Use the relevant release build for the target. Use DevTools to inspect frames, CPU, memory, network, and app size.
Usual Flutter Performance Bugs
| Bug | Fix direction |
|---|---|
Expensive work in build() | Move to view model, repository, isolate, or cached state |
| Giant rebuild scope | Localize state and split widgets |
Missing const | Mark stable widget subtrees const |
| Expensive opacity/clipping/saveLayer | Simplify rendering or profile exact cost |
| Intrinsic layout in long lists | Avoid intrinsic passes in scrolling layouts |
| Huge image/assets | Resize, cache, and measure app size |
Gotcha: Smooth on a workstation emulator does not prove smooth on a budget Android phone or older iPhone.