Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Flutter and app store releases

A Flutter app feels slow, stutters while scrolling or lags on taps

Your error

The app stutters while scrolling or animating2 more lines it can show

Fix it fast

Most common cause, 1 of 4

The app is judged from a debug build or an emulator

Judge speed only from profile or release builds on real hardware.

Fix
flutter run --profile
flutter run --release
Did this fix it?
Full steps for this cause: check, fix, verify

Short 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.

  • Applies to Flutter 3.50 stable, Dart 3.14
  • Updated
  • By Maaz Zindani, Senior Software Engineer

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.

Run this first
flutter run --profile

Then find the line you see in this list and open its fix:

  1. 1The app is judged from a debug build or an emulatorThe lag shows with a plain flutter run or the IDE's default run, and disappears with flutter run --profile
  2. 2setState runs high in the tree and rebuilds far more than changedWith Track Widget Builds on in DevTools, a small change, such as a counter or a text field, rebuilds most of the screen
  3. 3A long list or grid is built all at onceOpening a screen with many items is slow, and the screen uses Column, ListView or GridView with a full children list
  4. 4Opacity, ShaderMask or ColorFilter force costly saveLayer callsJank 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 animating
  • Taps and screen changes feel laggy, mostly in a build started with flutter run
  • Frames 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.

Check
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.

Fix
flutter run --profile
flutter run --release

Verify

The same flow runs smoothly in profile mode, and the DevTools frame chart shows frames under the budget.

Verify
flutter run --profile

Confirmed by docs.flutter.dev

Did this fix it?

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.

Check
flutter run --profile

Fix

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.

Fix
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.

Verify
flutter run --profile

Confirmed by docs.flutter.dev

Did this fix it?

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.

Check
grep -rnE "ListView\(|GridView\.count\(" lib

Fix

Switch to the lazy builder constructors, which build only what is visible and create the rest as the user scrolls.

Fix
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.

Verify
flutter run --profile

Confirmed by docs.flutter.dev

Did this fix it?

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.

Check
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.

Fix
// instead of Opacity(opacity: 0.5, child: Text('Hi'))
Text('Hi', style: TextStyle(color: Color(0x80000000))) // black at 50% alpha

Verify

With checkerboarding still on, fewer areas are checkerboarded, and the fade runs within the frame budget.

Verify
flutter run --profile

Confirmed by docs.flutter.dev

Did this fix it?

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.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.