restoreSnapshot method

void restoreSnapshot(
  1. EntityGraphSnapshot snapshot
)

Restore one graph-owned snapshot through the normal publication boundary.

Implementation

void restoreSnapshot(EntityGraphSnapshot snapshot) {
  _write(() {
    _entities
      ..clear()
      ..addAll({
        for (final type in snapshot.entities.entries)
          type.key: {
            for (final entity in type.value.entries)
              entity.key: Map<String, Object?>.of(entity.value),
          },
      });
    _patches
      ..clear()
      ..addAll({
        for (final type in snapshot.patches.entries)
          type.key: {
            for (final patch in type.value.entries)
              patch.key: Map<String, Object?>.of(patch.value),
          },
      });
    _entityStates
      ..clear()
      ..addAll(snapshot.entityStates);
    _syncMetadata
      ..clear()
      ..addAll(snapshot.syncMetadata);
    _lists
      ..clear()
      ..addAll({
        for (final entry in snapshot.lists.entries)
          entry.key: _copyListState(entry.value),
      });
    _listTypes
      ..clear()
      ..addAll(snapshot.listTypes);
    _notifyReset();
  });
}