patchEntity method

int patchEntity(
  1. String key,
  2. Map<String, Object?> fields
)

Pushes a hand-written field change onto the overlay stack and returns the layer id, for the undo. Refused for an owned entity.

Implementation

int patchEntity(String key, Map<String, Object?> fields) {
  _ready();

  if (_cache.ownsKey(key)) _refuse('patch', key);

  _record(ActionKind.rollback, 'patch $key');

  final id = _cache.pushMerge(key, fields);

  _cache.notifyChanged();

  return id;
}