Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel/Abort request #459

Closed
CesaTor opened this issue Jul 31, 2023 · 2 comments · May be fixed by #645
Closed

Cancel/Abort request #459

CesaTor opened this issue Jul 31, 2023 · 2 comments · May be fixed by #645
Labels
wontfix This will not be worked on

Comments

@CesaTor
Copy link

CesaTor commented Jul 31, 2023

Is your feature request related to a problem? Please describe.
I can't see any way to cancel or abort a request after it's sent

Describe the solution you'd like
I've seen in retrofit that it exists something like
@CancelRequest() CancelToken cancelToken
to allow the cancellation of a request.
I know this package uses http instead of dio but maybe there's a way to implement it too

Describe alternatives you've considered
I tried to cancel the Future in other ways or simply add a check to update the ui only if the response I get is the latest one using a scoped UniqueKey but it's pretty ugly and not that performant

Additional context
I'd really like to have something like that since I'm very happy with the package and find it very robust and consistent

@CesaTor CesaTor added the enhancement New feature or request label Jul 31, 2023
@fryette
Copy link
Contributor

fryette commented Jul 31, 2023

It's impossible to cancel the request if it has already been sent.
You can read more about the Cancellation token to understand how it works. You can implement such logic by yourself.
Dio is useful but, at the same time, overloaded by such features.

@techouse techouse added wontfix This will not be worked on and removed enhancement New feature or request labels Aug 1, 2023
@techouse
Copy link
Collaborator

techouse commented Aug 1, 2023

Duplicate of #445

Blocked by dart-lang/http#424

@techouse techouse marked this as a duplicate of #445 Aug 1, 2023
@techouse techouse closed this as completed Aug 1, 2023
@techouse techouse linked a pull request Dec 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants