SaveChangeSet constructor

SaveChangeSet({
  1. List<String> added = const [],
  2. List<String> updated = const [],
  3. List<String> removed = const [],
  4. String? note,
})

Creates a change set with optional details.

Implementation

SaveChangeSet({
  this.added = const [],
  this.updated = const [],
  this.removed = const [],
  this.note,
}) {
  final hasNote = note != null && note!.isNotEmpty;
  if (added.isEmpty && updated.isEmpty && removed.isEmpty && !hasNote) {
    throw ArgumentError(
      'ChangeSet must not be empty. '
      'Use SaveChangeSet.none() or provide a note.',
    );
  }
}