cancelUpdates method

void cancelUpdates()

Reverts all unapplied cached inserts, edits, and deletes.

This operation is intended for FdcUpdateMode.cachedUpdates workflows and rebuilds the active view from accepted record state.

Implementation

void cancelUpdates() {
  _ensureOpen();
  if (!_tryCancelActiveEdit()) {
    return;
  }

  if (!hasUpdates) {
    return;
  }

  _bumpDataRevision();
  _view.clearComparableValueCache();
  _schemaCoordinator.updateApplier.cancelCachedUpdates(_recordStore);
  _applyCoordinator.clearPendingImmediateDeletes();
  _errorController.clearErrors(notify: false);
  _clearRetainedVisibleRecords();

  _rebuildView(notify: false);
  _cursorCoordinator.normalize(
    _view.normalizeCurrentIndex(_cursorCoordinator.currentIndex),
  );
  notifyListeners();
}