ScaleDiverging<Y> constructor

ScaleDiverging<Y>({
  1. List<num>? domain,
  2. required Y interpolator(
    1. num
    ),
})

Constructs a new diverging scale with the specified domain and interpolator function.

final color = ScaleDiverging(
  domain: [-1, 0, 1],
  interpolator: interpolateRdBu,
);

If domain is not specified, it defaults to [0, 0.5, 1].

final color = ScaleDiverging(interpolator: interpolateRdBu);

When the scale is applied, the interpolator will be invoked with a value typically in the range [0, 1], where 0 represents the extreme negative value, 0.5 represents the neutral value, and 1 represents the extreme positive value.

A diverging scale’s domain must be numeric and must contain exactly three values.

Implementation

ScaleDiverging({List<num>? domain, required super.interpolator}) {
  initLinearish();
  if (domain != null) this.domain = domain;
}