2

I'm creating a drawing app using flutter. I've used gesturedetector onpanstart, onpanend, onpanupdate. But I have to close the array of offsets. Because of null safety I am not able to use 'null'. how can I add a null value on the List or end up the list somehow. or any other ways to make a drawing app using flutter.

onPanEnd:(details){setState((){drawingPoints.add(null!);});}
dev-ruman
  • 21
  • 3

1 Answers1

0

To clear the available data in your List use .clear() or to assign a null value simply assign null to it

onPanEnd:(details){setState((){drawingPoints = null;});} // to assign null

onPanEnd:(details){setState((){drawingPoints.clear();});} // to clear the data
Diwyansh
  • 2,961
  • 1
  • 7
  • 11