replace method

  1. @override
void replace(
  1. String id,
  2. NmCommandSet record
)
override

Replace.

Implementation

@override
void replace(String id, NmCommandSet record) {
  final index = _records.indexWhere((item) => item.id == id);
  if (index < 0) throw NmCommandSetRepositoryException('Command set $id not found.');
  if (record.id != id) {
    throw const NmCommandSetRepositoryException('The id of an existing command set cannot change.');
  }
  final next = List<NmCommandSet>.of(_records);
  next[index] = record;
  _records = next;
}