getSnapshotMetadata method

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

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 {
  // Reject an empty id up front, mirroring `getSnapshot`'s normalization.
  _normalizeGetSnapshotOptions(snapshotId, null);
  // A single document read: the snapshot document already carries every
  // metadata field, so unlike the full read there is no read-only
  // transaction and no shard/diff reconstruction of the conversation state.
  final snap = await _snapshotsCol(context).doc(snapshotId).get();
  if (!snap.exists) return null;
  return _toMetadataSnapshot(_SnapshotDoc.fromData(snap.data()!));
}