I need to set a timeout for http requests.
I have read Set timeout for HTTPClient get() request and it suggests us to use http.get(...).timeout(...).
However, I am worried: that .timeout is a method in Future class. Therefore, even if it timeouts, the http request is still ongoing! In other words, if the http request actually needs, say, 30 seconds to finish, and we use timeout(Duration(seconds: 5)), then even if it seems as if we have aborted the request, it is actually still costing resources of the phone of the user for another 25 seconds.
Therefore, I would appreciate it if there is a proper way to timeout requests. Or, please correct me if I am wrong.
P.S. I know there is another thing, HttpClient.connectionTimeout. That is for connecting phase, not the time of whole request. Interestingly, when I go into the source code see here, I find that it also uses some_future.timeout() internally. Therefore, the resources, IMHO, are also not released when timeout.