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< skipped = const [], String? app, String? env, String? device, String? route, DateTime? exportedAt})String, Object?> > -
Creates a snapshot of
storageandbackpackvalues.const - LiveSnapshot.fromPayload(Object? payload, {String? device})
-
Reads the payload
storage.exportreturned fromdevice.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 --towrites. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toImportJson(
) → Map< String, Object?> -
What
snapshot.importis 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 byexport --to, the output ofexport --json, or a bare{"storage": ..., "backpack": ...}object. -
describeEntry(
Object? entry) → ({String type, Object? value}) -
The type and value shown for a storage or Backpack
entryin a table.
Constants
- formatVersion → const int
-
The
nylovalue written to snapshot files. - largeSize → const int
- Above this many bytes, export suggests leaving caches out.