replace method
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;
}