scale method Null safety

PrimitiveGradient scale(
  1. double factor
)

"Scaling" this gradient represents reducing the opacity of all its colors by Color.lerp with null using factor as the keyframe t.

Implementation

PrimitiveGradient scale(double factor) => PrimitiveGradient._(
      colors
          .map<Color>((Color color) => Color.lerp(null, color, factor)!)
          .toList(growable: false),
      stops,
    );