get method

Future<Response> get(
  1. String url, {
  2. Map<String, String>? headers,
})

Sends an HTTP GET request with the given headers to the given url.

Implementation

Future<http.Response> get(String url, {Map<String, String>? headers}) async =>
    await retry(
      () => client
          .get(
            Uri.parse(Uri.encodeFull(url)),
            headers: headers,
          )
          .timeout(const Duration(seconds: 20)),
      delayFactor: const Duration(seconds: 5),
      maxAttempts: 15,
      retryIf: (e) => e is SocketException || e is TimeoutException,
      onRetry: (e) => print('${e.runtimeType} - Retrying to GET $url'),
    );