put method

FutureOr<ISunnyContact?> put(
  1. MKey id,
  2. void modification(
    1. ISunnyContact _in
    ), {
  3. bool ignoreNotLoaded = false,
})
inherited

Updates the internal map without triggering any persistence. It's possible that other entities that are observing this store will update.

Implementation

FutureOr<V?> put(MKey id, void modification(V _in),
    {bool ignoreNotLoaded = false}) {
  final record = _internalGet(id);
  final modify = record.modify((value) {
    final cloned = repository.clone(value);
    modification(cloned);
    return cloned;
  }, ignoreNotLoaded: ignoreNotLoaded);
  applyChanges((_) => _.change(id, record));
  return modify;
}