undo method

void undo()

It will remove last action from _latestActions. The last action will be saved to _revertedActions that will be used to do redo-ing. Then, it will modify the real points with the last action.

Implementation

void undo() {
  if (_latestActions.isNotEmpty) {
    final List<Point> lastAction = _latestActions.removeLast();
    _revertedActions.add(<Point>[...lastAction]);
    if (_latestActions.isNotEmpty) {
      points = <Point>[..._latestActions.last];
      return;
    }
    points = <Point>[];
    notifyListeners();
  }
}