getSnapshotMetadata method

  1. @override
Future<SessionSnapshot?> getSnapshotMetadata(
  1. String snapshotId, {
  2. Map<String, dynamic>? context,
})
override

SessionStore.getSnapshot by snapshotId without the state: the returned row carries every other field as stored, with state null, and the same null-if-not-found contract.

Implementation

@override
Future<SessionSnapshot?> getSnapshotMetadata(
  String snapshotId, {
  Map<String, dynamic>? context,
}) async {
  // Validate the id the same way `getSnapshot` does (reject empty), so the
  // metadata path honors the same contract instead of silently returning
  // null for a blank id.
  normalizeGetSnapshotOptions(snapshotId: snapshotId);
  // Strip directly off the stored row: `stripSnapshotState` deep-clones only
  // the retained fields, so a caller can mutate the result without reaching
  // this row and we never copy the (possibly large) state payload.
  final snap = _snapshots[snapshotId];
  return snap != null ? stripSnapshotState(snap) : null;
}