Google Flutter Google Flutter Performance 1 — Questions and Answers
Question 1: Which Flutter tool provides a visual overlay showing render performance with colored bars?
- Flutter Inspector
- Performance Overlay (Correct answer)
- Widget Profiler
- Frame Analyzer
Correct answer: Performance Overlay
The Performance Overlay displays two graphs showing GPU and CPU frame rendering times, highlighting frames that exceed 16ms.
Question 2: What is the target frame rendering time to achieve 60 FPS in Flutter?
- 8ms
- 16ms (Correct answer)
- 32ms
- 33ms
Correct answer: 16ms
To sustain 60 FPS, each frame must complete in under 16ms (1000ms / 60 frames).
Question 3: Which widget should you use to avoid rebuilding expensive subtrees when parent state changes?
- RepaintBoundary
- const constructor widgets (Correct answer)
- StatelessWidget
- AnimatedBuilder
Correct answer: const constructor widgets
Marking widgets as const tells the Dart compiler they are immutable, so Flutter can skip rebuilding them when the parent rebuilds.
Question 4: What does RepaintBoundary do in Flutter's rendering pipeline?
- Clips its child to a rectangle
- Isolates its child on a separate compositing layer to avoid repainting the whole tree (Correct answer)
- Adds a border for debugging
- Forces a widget to repaint every frame
Correct answer: Isolates its child on a separate compositing layer to avoid repainting the whole tree
RepaintBoundary creates a new compositing layer for its child, so only that subtree is repainted when it changes, not the entire tree.
Question 5: Which Flutter DevTools tab helps identify the most expensive widgets during a performance session?
- Network tab
- Logging tab
- CPU Profiler / Performance tab (Correct answer)
- Memory tab
Correct answer: CPU Profiler / Performance tab
The CPU Profiler in Flutter DevTools shows a flame chart of method calls, identifying which widgets and functions consume the most CPU time.
Question 6: What is jank in Flutter?
- A memory leak caused by unclosed streams
- Visible stuttering or dropped frames when the UI fails to render within the frame budget (Correct answer)
- A network timeout error
- A build error in release mode
Correct answer: Visible stuttering or dropped frames when the UI fails to render within the frame budget
Jank refers to dropped frames or stuttering caused by frames taking longer than 16ms to render, resulting in a non-smooth UI.
Which Flutter tool provides a visual overlay showing render performance with colored bars?