SocketException one way or the other doesn’t detect no web join what I’m utilizing is one thing like regular Exception it does get triggered solely when web just isn’t obtainable or when request doesn’t proceed. All different Exceptions like timeout and many others.. are return as type of http.Response object, you’ll be able to deal with them by means of that.
@override
Future<http.Response?> putHttp(
{required String endPoint,
Period timeOut = const Period(seconds: timeOutDuration),
Map<String, String>? headers,
Map<String, dynamic>? requestBody}) async {
strive {
// name http request
http.Response response = await http
.put(
Uri.parse(endPoint),
physique: requestBody,
headers: headers,
)
.timeout(timeOut);
return response;
} on Exception catch (_) {
return null;
}
}