fetch method

Future<SanityQueryResponse> fetch(
  1. String query, {
  2. Map<String, String>? params,
})

Fetches data from Sanity by running the GROQ Query with the passed in parameters

Implementation

Future<SanityQueryResponse> fetch(
  String query, {
  Map<String, String>? params,
}) async {
  final request = SanityRequest(
    urlBuilder: urlBuilder,
    query: query,
    params: params,
  );

  if (request.requiresPost) {
    return _executePost(request);
  }
  return _executeGet(request);
}