getAll<T> method

Future<List<DocumentSnapshot<T>>> getAll<T>(
  1. List<DocumentReference<T>> documentsRefs, {
  2. List<FieldPath>? fieldMasks,
})

Retrieve multiple documents from the database by the provided documentsRefs. Holds a pessimistic lock on all returned documents. If any of the documents do not exist, the operation throws a FirebaseFirestoreAdminException with FirestoreClientErrorCode.notFound.

  • documentsRefs A list of references to the documents to retrieve.
  • fieldMasks A list of field masks, one for each document.

Returns a list of DocumentSnapshot containing the retrieved documents in the same order as the provided documentsRefs.

Implementation

Future<List<DocumentSnapshot<T>>> getAll<T>(
  List<DocumentReference<T>> documentsRefs, {
  List<FieldPath>? fieldMasks,
}) async {
  if (_writeBatch != null && _writeBatch._operations.isNotEmpty) {
    throw Exception(readAfterWriteErrorMsg);
  }
  return _withLazyStartedTransaction<List<DocumentReference<T>>,
      List<DocumentSnapshot<T>>>(
    documentsRefs,
    fieldMask: fieldMasks,
    resultFn: _getBatchFn<T>,
  );
}