I am using the http dart library to perform REST API requests (GET, POST) to a remote server.
When the server is not running the requests time-out.
Is there a default time limit for the requests, after which a Connection timed out
exception is thrown? If yes, which is that time limit?
We tried logging the timestamp before and after the request was performed. The difference of the 2 timestamps was 30ms. But we do not know if this is the default configuration of the dart library.
CodePudding user response:
The default timeout for an HTTP request made via dart:io
's HttpClient
is dependent on the default timeout for the OS, so it's hard to say exactly what timeout should be expected.
However, you can configure the timeout by setting connectionTimeout
on your HttpClient
instance to a non-null Duration
if you want to have a consistent connection timeout duration across platforms.