StorageSnapshot.fromJson constructor

StorageSnapshot.fromJson(
  1. Map<Object?, Object?> json
)

Reads a snapshot from json, as written by toJson or held by an exported seeder. Only storage and backpack are read; both are optional.

Throws a LiveException when a value can't be put into storage.

Implementation

factory StorageSnapshot.fromJson(Map<Object?, Object?> json) {
  final Map<String, Object?> storage = _stringKeyed(
    json['storage'],
    'storage',
  );
  final Map<String, Object?> backpack = _stringKeyed(
    json['backpack'],
    'backpack',
  );
  storage.forEach(_validateStorageEntry);
  backpack.forEach(_validateBackpackEntry);
  return StorageSnapshot(storage: storage, backpack: backpack);
}