LiveSnapshot class

A storage snapshot on Metro's side: what storage.export returns, what export --to writes in metro live, and the map an exported seeder holds.

Storage values are plain literals where Dart's type says enough, and {'type': ..., 'value': ...} tags for models, raw values, values with a ttl, and JSON objects with a type key of their own. Backpack models carry their class name so the app can rebuild them. The app owns the format; Metro only carries it.

Constructors

LiveSnapshot({required Map<String, Object?> storage, required Map<String, Object?> backpack, List<Map<String, Object?>> skipped = const [], String? app, String? env, String? device, String? route, DateTime? exportedAt})
Creates a snapshot of storage and backpack values.
const
LiveSnapshot.fromPayload(Object? payload, {String? device})
Reads the payload storage.export returned from device.
factory

Properties

app → String?
The app's APP_NAME, when known.
final
backpack → Map<String, Object?>
The Backpack values, by key.
final
device → String?
The device the snapshot was taken from, when known.
final
env → String?
The app's APP_ENV, when known.
final
exportedAt → DateTime?
When the snapshot was taken, when known.
final
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Whether the snapshot holds nothing.
no setter
length → int
How many values the snapshot holds.
no setter
route → String?
The route the app was on, when known.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
secretKeys → List<String>
Keys whose name, or a name inside their value, looks like a credential, or whose text value looks like a JWT.
no setter
sizeInBytes → int
The size of the values as JSON, in bytes.
no setter
skipped → List<Map<String, Object?>>
What the app left out, each as {store, key, reason}.
final
storage → Map<String, Object?>
The storage values, by key.
final
summary → String
3 storage values, 2 Backpack values.
no setter

Methods

encode() → String
The file export --to writes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toImportJson() → Map<String, Object?>
What snapshot.import is sent.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

decode(String text) → LiveSnapshot
Reads text: a file written by export --to, the output of export --json, or a bare {"storage": ..., "backpack": ...} object.
describeEntry(Object? entry) → ({String type, Object? value})
The type and value shown for a storage or Backpack entry in a table.

Constants

formatVersion → const int
The nylo value written to snapshot files.
largeSize → const int
Above this many bytes, export suggests leaving caches out.