Mobile App Development — Level 4: Professional Release, Payments & Growth
Free preview

Profiling and performance

1 / 3

Targets

  • 60/120 fps: ~16/8 ms per frame
  • Fast start-up
  • Small download size
2 / 3

Tools

  • Profile mode
  • Flutter DevTools
  • Performance overlay
3 / 3

Fixes

  • const widgets, smaller rebuilds
  • ListView.builder
  • Isolates for heavy work

Lecture notes

Users judge apps by smoothness. At 60 frames per second, each frame must be built and rendered in about 16 ms (8 ms at 120 Hz). Missed frames are visible as jank.

Measure first

  • Never judge performance in debug mode — run flutter run --profile on a real, modest device.
  • Flutter DevTools: Performance view (frame chart, UI vs raster thread), CPU profiler, Memory view, Widget rebuild counts, Network.
  • Performance overlay (showPerformanceOverlay: true) shows frame times on screen.

Common causes and fixes

  • Too many rebuilds — use const constructors; split large widgets; listen to small pieces of state (select, Consumer).
  • Long lists built at once — use ListView.builder / GridView.builder (lazy), set itemExtent when rows have a fixed height.
  • Heavy computation on the UI thread — move JSON parsing, image processing or encryption to a background isolate with compute() or Isolate.run().
  • Expensive painting — avoid unnecessary Opacity, ClipRRect and shadows in animated lists; use RepaintBoundary around complex static parts.
  • Large images — resize on the server, use cacheWidth/cacheHeight, WebP format, cached_network_image.

Start-up and size

  • Defer non-essential initialisation until after the first frame.
  • Build Android App Bundles so Play delivers only the code for each device; flutter build apk --analyze-size shows what takes space.
  • Remove unused packages and assets; use deferred loading for rarely used features.
Want to go further?
22 h · Enroll to access every lesson and earn the certificate.
Get Started Free