request<T> method
Implementation
Future<Response<T>> request<T>(
String url,
String method, {
dynamic body,
String? contentType,
Map<String, String>? headers,
Map<String, dynamic>? query,
Decoder<T>? decoder,
ResponseInterceptor<T>? responseInterceptor,
Progress? uploadProgress,
}) async {
try {
var response = await _performRequest<T>(
() => _request<T>(
url,
method,
contentType: contentType,
query: query,
body: body,
decoder: decoder,
responseInterceptor: responseInterceptor,
uploadProgress: uploadProgress,
),
headers: headers,
);
return response;
} on Exception catch (e) {
if (!errorSafety) {
throw GetHttpException(e.toString());
}
return Future.value(Response<T>(
statusText: 'Can not connect to server. Reason: $e',
));
}
}