Skip to main content
InterviewHubPRO
Section Overview
Q28

Question 28 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

56%
Flutter & Dart (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

What is `saveLayer()` and why is it expensive for GPU performance?

senior LevelFormsPerformance

In Simple Words: saveLayer() redirects rendering to an off-screen intermediate texture buffer before composite-rendering it back to the screen:

  • Triggered by Opacity (when applied to complex subtrees), ShaderMask, and ClipRRect.
  • Forces GPU pipeline flushes and consumes high memory bandwidth.
  • Optimization: Avoid wrapping complex lists in Opacity; use color opacity (Color.withOpacity()) directly instead.