ScaleSequential<Y> constructor
Constructs a new sequential scale with the specified domain
and
interpolator
function.
final color = ScaleSequential(
domain: [0, 100],
interpolator: interpolateBlues,
);
If domain
is not specified, it defaults to [0, 1].
final color = ScaleSequential(interpolator: interpolateBlues);
When the scale is applied, the interpolator will be invoked with a value typically in the range [0, 1], where 0 represents the minimum value and 1 represents the maximum value. For example, to implement the ill-advised angry rainbow scale (please use interpolateRainbow instead):
final rainbow = ScaleSequential(interpolator: (t) => Hsl(t * 360, 1, 0.5).toString());
A sequential scale’s domain must be numeric and must contain exactly two values.
Implementation
ScaleSequential({List<num>? domain, required super.interpolator}) {
initLinearish();
if (domain != null) this.domain = domain;
}