readEntity method

Map<String, Object?>? readEntity(
  1. String type,
  2. String id
)

Read canonical entity merged with patches, or null if absent.

Implementation

Map<String, Object?>? readEntity(String type, String id) {
  final base = _entities[type]?[id];
  if (base == null) return null;
  final patch = _patches[type]?[id];
  if (patch == null || patch.isEmpty) return Map.unmodifiable(base);
  return Map.unmodifiable({...base, ...patch});
}