getData4 method
Implementation
Future<Response> getData4(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);
}
}
}