A Flutter app feels slow, stutters while scrolling or lags on taps
Fix it fast
Most common cause, 1 of 4The app is judged from a debug build or an emulator
Judge speed only from profile or release builds on real hardware.
flutter run --profile
flutter run --releaseShort answer
A slow or janky Flutter app (Flutter 3.50, Dart 3.14) is most often judged from a debug build, which the Flutter docs call unrepresentative. Measure with flutter run --profile on a real device and DevTools. Frames over about 16 ms then point to setState called high in the tree, lists built all at once, or saveLayer-heavy widgets such as Opacity.
Which cause do you have?
Run the app in profile mode on a physical phone, then open DevTools and watch the frame chart while you repeat the slow action. If the lag is gone, the debug build was the cause; if frames still pass about 16 ms, the causes below apply.
flutter run --profileThen find the line you see in this list and open its fix:
- 1The app is judged from a debug build or an emulator
The lag shows with a plain flutter run or the IDE's default run, and disappears with flutter run --profile - 2setState runs high in the tree and rebuilds far more than changed
With Track Widget Builds on in DevTools, a small change, such as a counter or a text field, rebuilds most of the screen - 3A long list or grid is built all at once
Opening a screen with many items is slow, and the screen uses Column, ListView or GridView with a full children list - 4Opacity, ShaderMask or ColorFilter force costly saveLayer calls
Jank appears on screens that fade, mask or tint content, and offscreen layers show up checkerboarded
What does the error look like?
The app stutters while scrolling or animatingTaps and screen changes feel laggy, mostly in a build started with flutter runFrames take longer than about 16 ms in the DevTools Performance view
Cause 1 of 4
The app is judged from a debug build or an emulator
You seeThe lag shows with a plain flutter run or the IDE's default run, and disappears with flutter run --profile
Check
A Flutter app feels slow in debug mode because that build is compiled for fast edit cycles, not for speed, and the docs warn that it can be janky. By default flutter run builds debug mode. Profile mode is not available on emulators or simulators, since their behaviour does not reflect real devices.
flutter devices
flutter run --profile -d <physical-device-id>Fix
Judge speed only from profile or release builds on real hardware. Keep debug mode for hot reload, which works only there.
flutter run --profile
flutter run --releaseVerify
The same flow runs smoothly in profile mode, and the DevTools frame chart shows frames under the budget.
flutter run --profileConfirmed by docs.flutter.dev
Cause 2 of 4
setState runs high in the tree and rebuilds far more than changed
You seeWith Track Widget Builds on in DevTools, a small change, such as a counter or a text field, rebuilds most of the screen
Check
A Flutter screen lags on small updates when setState sits in a large parent, because build() can run again for every widget under it. Turn on Track Widget Builds in the DevTools Performance view and repeat the action to see how much is rebuilt.
flutter run --profileFix
Move the changing state into the smallest widget that shows it, split a huge build() into separate widgets along the lines of what changes, and keep costly work out of build(). In an AnimatedBuilder, build the part that does not animate once and pass it in as child.
AnimatedBuilder(
animation: controller,
child: const ExpensiveHeader(), // built once
builder: (context, child) => Transform.rotate(
angle: controller.value,
child: child,
),
)Verify
Repeat the action with Track Widget Builds on: only the widgets that show the change rebuild, and the frame times drop.
flutter run --profileConfirmed by docs.flutter.dev
Cause 3 of 4
A long list or grid is built all at once
You seeOpening a screen with many items is slow, and the screen uses Column, ListView or GridView with a full children list
Check
A Flutter screen with a long list opens slowly when every item is built up front, because a children list builds all of them even when most are off screen. Look for ListView or Column with a large children list.
grep -rnE "ListView\(|GridView\.count\(" libFix
Switch to the lazy builder constructors, which build only what is visible and create the rest as the user scrolls.
ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) => ListTile(title: Text(items[index].title)),
)Verify
The screen opens without a pause, and scrolling stays within the frame budget in the DevTools frame chart.
flutter run --profileConfirmed by docs.flutter.dev
Cause 4 of 4
Opacity, ShaderMask or ColorFilter force costly saveLayer calls
You seeJank appears on screens that fade, mask or tint content, and offscreen layers show up checkerboarded
Check
A Flutter screen that fades or tints content can stutter because widgets such as Opacity, ShaderMask and ColorFilter may call saveLayer, which draws into an offscreen buffer. Turn on checkerboardOffscreenLayers to see which parts are drawn that way.
MaterialApp(
checkerboardOffscreenLayers: true,
home: const HomePage(),
)Fix
Draw simple shapes and text with a semitransparent color instead of wrapping them in Opacity, use AnimatedOpacity for fades and FadeInImage for images that fade in, and keep Opacity for cases that need it.
// instead of Opacity(opacity: 0.5, child: Text('Hi'))
Text('Hi', style: TextStyle(color: Color(0x80000000))) // black at 50% alphaVerify
With checkerboarding still on, fewer areas are checkerboarded, and the fade runs within the frame budget.
flutter run --profileConfirmed by docs.flutter.dev
How do I stop it coming back?
- Measure every performance complaint in profile mode on a real phone before changing code.
- Use ListView.builder or GridView.builder for any list whose length depends on data.
- Turn on Track Widget Builds in DevTools when a new screen is added, and check that small changes rebuild small parts.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, Qist Bazaar, SessionBird.