Unable to abort a dart:io http request while the connection is being established. #51267
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-io
type-enhancement
A request for a change that isn't a bug
In 2020, an
abort
method was added to theHttpClientRequest
object in thedart:io
library, allowing us to abort ongoing HTTP requests (see #22265, which is now closed). However, as per a comment by @sgjesse on that issue:This is still true. Whilst we can now abort the request once it starts, we can't abort during the initial stage in which a connection is established. In my testing, I frequently encounter a situation where the device has a poor internet connection, and thus gets stuck at this point, with no way for the user to abort it.
I think there should be a better solution for aborting requests which does not only abort one part of the request timeline. A potential solution would be some sort of cancellation token which could be passed into the initial
openUrl
(orgetUrl
,postUrl
, etc.) call, something also suggested by @sgjesse in that same comment:The text was updated successfully, but these errors were encountered: