toJson method
Converts this snapshot to a JSON-serializable map.
The output matches the snapshot data model schema:
{
"schemaVersion": 1,
"appVersion": "1.2.3",
"timestamp": "2026-01-26T12:00:00.000Z",
"states": {
"user_state": { ... },
"settings_state": { ... }
}
}
The timestamp is formatted as ISO 8601 UTC string.
This method uses SnapshotSerializer internally to ensure consistent serialization format.
Implementation
Map<String, dynamic> toJson() => SnapshotSerializer.instance.toJson(this);