CatmullRomSpline.precompute constructor Null safety
Constructs a centripetal Catmull-Rom spline curve.
The same as CatmullRomSpline.new, except that the internal data structures are precomputed instead of being computed lazily.
Implementation
CatmullRomSpline.precompute(
List<Offset> controlPoints, {
double tension = 0.0,
Offset? startHandle,
Offset? endHandle,
}) : assert(controlPoints != null),
assert(tension != null),
assert(tension <= 1.0, 'tension $tension must not be greater than 1.0.'),
assert(tension >= 0.0, 'tension $tension must not be negative.'),
assert(controlPoints.length > 3, 'There must be at least four control points to create a CatmullRomSpline.'),
_controlPoints = null,
_startHandle = null,
_endHandle = null,
_tension = null,
_cubicSegments = _computeSegments(controlPoints, tension, startHandle: startHandle, endHandle: endHandle);