stops property

  1. @useResult
List<double> get stops

The two normalized gradient stops (0..1) for this easing category.

Returns a fresh two-element list on every call. A new literal is built each time rather than a cached shared instance so a caller that mutates the result (e.g. ..add(2)) cannot corrupt the value seen by a later .stops read on the same variant — the values must stay constant.

The switch is exhaustive over StopRange, so adding a future variant without giving it stops is a compile-time error rather than a silent gap.

Example:

StopRange.easeIn.stops;    // [0, 0.5]
StopRange.easeOut.stops;   // [0.5, 1]
StopRange.easeInOut.stops; // [0.25, 0.75]
StopRange.linear.stops;    // [0, 1]

Audited: 2026-06-12 11:26 EDT

Implementation

@useResult
List<double> get stops => switch (this) {
  StopRange.easeIn => <double>[0, 0.5],
  StopRange.easeOut => <double>[0.5, 1],
  StopRange.easeInOut => <double>[0.25, 0.75],
  StopRange.linear => <double>[0, 1],
};