getData3 method

Future<Response> getData3(
  1. String uri, {
  2. Map<String, dynamic>? query,
  3. Map<String, String>? headers,
})

Implementation

Future<Response> getData3(String uri,
    {Map<String, dynamic>? query, Map<String, String>? headers}) async {
  await getApiToken();
  if (await ApiChecker.isVpnActive()) {
    return const Response(statusCode: -1, statusText: 'you are using vpn');
  } else {
    try {
      logCat('====> API Call: $uri\nHeader: $_mainHeaders');
      logCat('====> API Call: $appBaseUrl$uri');
      String apiUrl = "$appBaseUrl$uri";
      http.Response response = await http
          .get(
            Uri.parse(apiUrl),
            headers: headers ?? _mainHeaders,
          )
          .timeout(Duration(seconds: timeoutInSeconds));
      return handleResponse(response, uri);
    } catch (e) {
      return Response(statusCode: 1, statusText: noInternetMessage);
    }
  }
}