save method

  1. @override
Future<Change<Record>?> save(
  1. String key,
  2. Record record
)
override

Adds or updates the model at a given key in the Source.

Implementation

@override
Future<Change<Record>?> save(String key, Record record) async {
  var existing = map[key];
  if (existing == record) {
    return null;
  }
  map[key] = record;
  if (existing == null) {
    return Added(key, record);
  }
  return Updated(key, record);
}