tezvyn:

Which DevTools view diagnoses janky Flutter animations?

AI-drafted, machine-checkedSource: docs.flutter.devintermediate
WHAT IT TESTS

DevTools fluency and frame pipeline anatomy.

ANSWER OUTLINE

Open Performance view; compare UI and Raster bars; flag bars over 16ms; blame UI bloat on builds and Raster jank on shaders or saveLayer.

WHAT THIS TESTS: Whether the candidate has actually debugged real animation jank or only read about it. The interviewer wants to hear the exact tool name, thread awareness, and a methodical reading of the flame chart.

A GOOD ANSWER COVERS: First, the candidate names the Performance view in Flutter DevTools, not the CPU Profiler or Widget Inspector. Second, they describe the flame chart as a timeline where each frame shows bars for the UI thread and the Raster thread. Third, they mention the frame budget, typically 16.67 milliseconds for 60 frames per second, and look for bars that exceed that budget or frames colored red to indicate jank. Fourth, they explain how to attribute the problem. If the UI thread bar is long, the issue is usually in Dart code such as an expensive build method, deep widget trees, or excessive layout passes. If the Raster thread bar is long, the issue is usually GPU side work like shader compilation, too many saveLayer operations, complex clipping, or large image decoding. Fifth, they might mention turning on Track Widget Builds or using Highlight Repaints to narrow the source after the flame chart points to a specific frame range.

COMMON WRONG ANSWERS: Using the CPU Profiler as the primary tool instead of the Performance view. Claiming you would look at the Widget Inspector to find jank. Stating that you only look at total frame time without separating UI and Raster thread work. Blaming the Flutter engine generically without explaining how to tell which thread is responsible. Suggesting you would add print statements or manual timers instead of using the built-in flame chart. Recommending StatelessWidget conversions as a blanket fix without identifying the actual hot path in the chart.

LIKELY FOLLOW-UPS: How would you fix UI thread jank if the flame chart shows a long build phase? What is the difference between shader compilation jank and build method jank? When would you use the CPU Profiler after identifying a slow frame in the Performance view? How do you interpret the frame chart on a 120Hz device where the budget is 8.33 milliseconds?

ONE CONCRETE EXAMPLE: A custom painter with drop shadows causes dropped frames. In the Performance view flame chart, the UI thread is fast but the Raster thread bar spikes to 28 milliseconds. Zooming into the chart reveals multiple saveLayer calls from the shadow rendering. The fix is to cache the shadow in a picture recorder or reduce the blur radius so the GPU workload fits inside the 16.67 millisecond budget.

Read the original → docs.flutter.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.