findAll method

Future<FeedbackResponse<List<Map<String, dynamic>>>> findAll()

Finds all documents of the specified _collectionPath.

This method returns raw data in the form of a List<Map<String, dynamic>>. If _tryAddLocalId is true then the map will also contain a local id field based on the _idFieldName specified in the constructor so you may retrieve document id's more easily after serialization.

If you rather want to convert this data into a list of T immediately you should use the findAllWithConverter method instead. Make sure to have specified the _toJson and _fromJson methods or else the FirestoreApi will not know how to convert the data to T.

Implementation

Future<FeedbackResponse<List<Map<String, dynamic>>>> findAll() async {
  try {
    _log.info('🔥 Finding all ${_collectionPath()} '
        'without converter..');
    final result = (await findCollection().get())
        .docs
        .map(
          (e) => e.data(),
        )
        .toList();
    _logResultLength(result);
    return _responseConfig.searchSuccessResponse(isPlural: result.isPlural, result: result);
  } catch (error, stackTrace) {
    _log.error('🔥 Unable to find ${_collectionPath()} all documents per findAll query',
        error: error, stackTrace: stackTrace);
    return _responseConfig.searchFailedResponse(isPlural: true);
  }
}