cancelEdit method

void cancelEdit()

Close the editor, restoring the copy beginEdit took or removing the entity insertAndEdit created.

Implementation

void cancelEdit() {
  final id = _editing;
  if (id == null) return;
  final previous = _preEdit;
  _editing = null;
  _preEdit = null;
  if (previous == null) {
    remove(id);
    return;
  }
  entities[entities.indexWhere((e) => e.id == id)] = previous;
  notifyListeners();
}