I've been following a tutorial on youtube for flutter.
CodePudding user response:
In the video you linked, there is a check whether points[x]
is null
, so I assume the elements of points
should be nullable. You can achieve this with
List<Offset?> points = [];
(instead of List<Offset> points = [];
).
The added questionmark makes it possible for elements of the list to be either a instance of the class Offset
or the value null
.
CodePudding user response:
The points is non-nullable list.
So this time, it can be solved with to remove points.add(null); inside onPanEnd. (Or add non-null Offset.)