sameLengthLerp method Null safety

PrimitiveGradient sameLengthLerp(
  1. PrimitiveGradient a,
  2. PrimitiveGradient b,
  3. double t
)

Linearally interpolate between PrimitiveGradients a and b at any given keyframe (double) t, generally 0.0 .. 1.0.

This method presumes the gradients have the same number of colors.

Implementation

static PrimitiveGradient sameLengthLerp(
  PrimitiveGradient a,
  PrimitiveGradient b,
  double t,
) {
  assert(a.colors.length == b.colors.length, 'list lengths should be equal');
  final length = a.colors.length;
  final lerpedStops = _mergeListDouble(a.stops, b.stops, t);
  final lerpedColors = <Color>[
    for (int i = 0; i < length; i++) Color.lerp(a.colors[i], b.colors[i], t)!,
  ];
  return PrimitiveGradient._(lerpedColors, lerpedStops);
}