save method

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

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

Implementation

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