Skip to main content
InterviewHubPRO
Section Overview
Q19

Question 19 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

38%
Flutter & Dart (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is `CustomPainter` and how do you paint directly onto the Canvas?

senior LevelSystem Design

In Simple Words: When no existing widget can render your design, CustomPainter gives you access to low-level graphics commands:

  • Subclass CustomPainter and implement:
    • paint(Canvas canvas, Size size): Draw lines, circles, paths, arcs, gradients, and text.
    • shouldRepaint(CustomPainter oldDelegate): Return true only when parameters change, avoiding redundant GPU redraws.