document method

Stream<D?> document()

Implementation

Stream<D?> document() {
  return ref.snapshots().map((snapshot) {
    if (firestoreOperationCounter.enabled) {
      firestoreOperationCounter.recordRead(
        isFromCache: snapshot.metadata.isFromCache,
      );
    }
    if (!snapshot.exists) {
      logger.warning('$D not found(id: ${ref.id})');
      return null;
    }
    return collectionRef.decode(
      snapshot,
      this,
    );
  });
}