Sparround

DevTools and profiling

Flutter DevTools is a browser-based tool suite and the centre of performance work:

  • Widget Inspector — the widget tree, the constraints each widget received (Layout Explorer), rebuild counts
  • Performance — a frame timeline showing which frame blew the budget and whether the time went to the UI or raster thread
  • CPU Profiler — which functions consume the time
  • Memory — memory usage and leak hunting
  • Network — outgoing requests

One requirement: measure in profile mode. Debug mode does not optimise the code and its numbers are far worse than reality — drawing conclusions from debug-mode measurements is a classic mistake.

SymptomWhere to lookTypical cause
Stutter while scrollingPerformance → frame timelineA heavy `itemBuilder`, non-const items
Freeze when a screen opensCPU ProfilerHeavy synchronous computation or a large JSON parse
Memory grows over timeMemory → allocationsAn uncancelled subscription or controller
A widget is unexpectedly largeInspector → Layout ExplorerThe parent passed tight constraints

Interview tip. "How do you find a memory leak?" comes up at middle level. Structure the answer: (1) open and close the screen several times; (2) watch memory in the Memory tab fail to come back down; (3) check the allocation list for which class is accumulating instances; (4) the cause is almost always a subscription, controller or listener not cancelled in dispose(). That four-step answer is concrete and shows experience.

📚 Sources and documentation