Mobile App Development — Level 4: Professional Release, Payments & Growth
Get Started Free
Free preview
Profiling and performance
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 --profileon 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
constconstructors; split large widgets; listen to small pieces of state (select,Consumer). - Long lists built at once — use
ListView.builder/GridView.builder(lazy), setitemExtentwhen rows have a fixed height. - Heavy computation on the UI thread — move JSON parsing, image processing or encryption to a background isolate with
compute()orIsolate.run(). - Expensive painting — avoid unnecessary
Opacity,ClipRRectand shadows in animated lists; useRepaintBoundaryaround 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-sizeshows 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.