hasUpdates property

bool get hasUpdates

True when the dataset contains pending persistent changes.

Inserted and deleted records always count as updates. Modified records count only when at least one changed field is persistent, so edits limited to non-persistent or calculated fields do not make this getter true.

Implementation

bool get hasUpdates {
  for (final record in _recordStore.records) {
    if (record.state == FdcRecordState.inserted ||
        record.state == FdcRecordState.deleted) {
      return true;
    }

    if (record.state != FdcRecordState.modified) {
      continue;
    }

    for (final fieldIndex in record.changedFieldIndexes()) {
      if (_fields[fieldIndex].isPersistent) {
        return true;
      }
    }
  }
  return false;
}