softness property Null safety

double softness

An incredibly small double to provide as an additive for each second entry when duplicating stops for this Steps.

A larger softness has the effect of reducing the hard edge in-between each color in this Steps, making it more like its original Gradient counterpart.

Imagine stops is [0.0, 0.3, 0.8]*. Providing a softness of 0.001, the effective, resolved stops for this Gradient is now:

[0.0, 0.001, 0.3, 0.3001, 0.8, 0.8001].

* Note:

These Steps work a little bit differently than standard Gradients.

The Gradient.colors & Gradient.stops fields are overridden with getters that duplicate these Lists.

But while colors is a duplicated Gradient.colors, these stops, if provided manually instead of using interpretation, are expected to follow a simple, but important format:

  • This constructor's stops should start with a 0.0, as after list duplication, the second entry in the list will be eliminated.
  • This constructor's stops should not end with a 1.0, as that will be added automatically.


final double softness;