sendRequest static method
Implementation
static Future<http.Response?>? sendRequest({
required String requestId,
required RequestType requestType,
required String url,
String token = '',
String contentType = 'application/json',
String? body,
Map<String, String>? head,
}) async {
try {
final headers = head ?? _getHeaders(token, contentType);
return await _createRequest(
requestId: requestId,
requestType: requestType,
uri: Uri.parse(url),
headers: headers,
body: body,
);
} on SocketException {
throw "No internet connection.";
} on HandshakeException {
throw "Connection terminated during handshake";
} catch (e) {
throw e.toString();
}
}