save method

  1. @override
Future<void> save(
  1. Snapshot snapshot, [
  2. String? key
])
override

Saves a snapshot to storage.

Parameters:

  • snapshot: The snapshot to save
  • key: Optional key/identifier for the snapshot. If not provided, a default key will be used.

Returns: A Future that completes when the snapshot is saved.

Throws:

  • Storage-specific exceptions (e.g., IOException for file storage)

Implementation

@override
Future<void> save(Snapshot snapshot, [String? key]) async {
  final storageKey = key ?? defaultKey;
  _storage[storageKey] = snapshot;
  debugPrint('[Checkpoint] Saved snapshot in memory with key: $storageKey');
}