SnapshotSerializer class

Serializes and deserializes snapshots to/from JSON with versioned schema support.

The SnapshotSerializer handles conversion between Snapshot objects and JSON, ensuring schema version compatibility and supporting future schema migrations.

Key Features:

  • Versioned schema support
  • Round-trip serialization (toJson/fromJson)
  • Schema validation
  • Future-proof for schema migrations

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

fromJson(Map<String, dynamic> json) Snapshot
Converts a JSON map to a Snapshot instance.
isValidJson(Map<String, dynamic> json) bool
Validates that a JSON map has the correct structure for a snapshot.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(Snapshot snapshot) Map<String, dynamic>
Converts a Snapshot to a JSON-serializable map.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance SnapshotSerializer
Get the singleton instance.
no setter

Constants

currentSchemaVersion → const int
Current supported schema version.