fetchCollection method

Future<CollectionFetched> fetchCollection(
  1. String type, {
  2. Map<String, List<String>> headers = const {},
  3. Iterable<QueryEncodable> query = const [],
})

Fetches the primary collection of type type.

Optional arguments:

  • headers - any extra HTTP headers
  • query - a collection of parameters to be included in the URI query

Implementation

Future<CollectionFetched> fetchCollection(
  String type, {
  Map<String, List<String>> headers = const {},
  Iterable<QueryEncodable> query = const [],
}) async {
  final response = await send(
      _baseUri.collection(type),
      Request.get()
        ..headers.addAll(headers)
        ..query.mergeAll(query));
  return CollectionFetched(
      response.httpResponse, response.document ?? (throw FormatException()));
}