urlRequest static method
Implementation
static Future<ApiCallResponse> urlRequest(
ApiCallType callType,
String apiUrl,
Map<String, dynamic> headers,
Map<String, dynamic> params,
bool returnBody,
bool decodeUtf8,
) async {
if (params.isNotEmpty) {
final specifier = Uri.parse(apiUrl).queryParameters.isNotEmpty ? '&' : '?';
apiUrl = '$apiUrl$specifier${asQueryParams(params)}';
}
final makeRequest = callType == ApiCallType.GET ? http.get : http.delete;
final response = await makeRequest(
Uri.parse(apiUrl),
headers: toStringMap(headers),
).timeout(_effectiveTimeout);
return ApiCallResponse.fromHttpResponse(response, returnBody, decodeUtf8);
}