isValidGradient static method

bool isValidGradient(
  1. List<LightColorXy>? points
)

Used when finalizing a gradient to send with PUT or POST.

For a less strict test, used to validate a gradient while still working with it, see isValidGradientDraft.

Returns true if:

  • points is null
  • points is empty
  • points has 2 to 5 (inclusive) elements

Implementation

static bool isValidGradient(List<LightColorXy>? points) =>
    points == null ||
    points.isEmpty ||
    (points.length >= 2 && points.length <= 5);