Wednesday, May 1, 2024
HomeiOS Developmentandroid - No Exception when Web not out there in HTTP Request...

android – No Exception when Web not out there in HTTP Request – Stack Overflow


When doing a HTTP request in Flutter I don’t get any Exception like SocketException when WiFi is on however there’s truly no web, quite it waits very long time till I get the outlined TimeoutException. Additionally this situation seems when there’s community connection to start with however immediately the connection drops.

How do I make it that it immediately provides an exception at any time when community points happen?

This my present code:

strive {
  await http
      .get(url, headers: headers)
      .timeout(const Period(seconds: 20));
} on SocketException catch (e, st) {
  debugPrint('SocketException. Appears to be no web out there');
  debugPrint(e.toString());
  debugPrint('OS Errorcode: ${e.osError?.errorCode.toString()}');
} catch (e, st) {
  debugPrint('Unknown error occur in `tryAndHandle`:');
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments