Thank you for posting this solution, however the suggested solution does not give a gradient color from one point to the next, it only changes the spline color at a certain point.
Is there a way to draw the spline as a gradient from one plotted point to the next plotted point. IE:
x:0,y:0 starts at red
to
x:10,y:10 ends in green
and have the color lerp between red and green like this
Color.lerp(Colors.red, Colors.green);