Gradient constructor

const Gradient(
  1. {required List<Color> colors,
  2. List<double>? stops,
  3. GradientTransform? transform}
)

Initialize the gradient's colors and stops.

The colors argument must have at least two colors (the length is not verified until the createShader method is called).

If specified, the stops argument must have the same number of entries as colors (this is also not verified until the createShader method is called).

The transform argument can be applied to transform only the gradient, without rotating the canvas itself or other geometry on the canvas. For example, a GradientRotation(math.pi/4) will result in a SweepGradient that starts from a position of 6 o'clock instead of 3 o'clock, assuming no other rotation or perspective transformations have been applied to the Canvas. If null, no transformation is applied.

Implementation

const Gradient({
  required this.colors,
  this.stops,
  this.transform,
});