fillMutable method

Paint fillMutable(
  1. Color color
)

Returns a new Paint seeded from the cached fill paint.

BUG FIX v2: the original implementation called fill(color)..shader = null which mutated the cached Paint object — any caller that previously set a shader on it would corrupt every subsequent use of that cache entry. Now we always return a fresh object so callers can safely mutate it.

Implementation

Paint fillMutable(Color color) {
  final cached = fill(color);
  return Paint()
    ..color = cached.color
    ..style = cached.style
    ..isAntiAlias = cached.isAntiAlias;
}