Dhavalketu Darji
Dhavalketu Darji

Reputation: 91

How we can make token.isCancelled false after cancel the token of Dio upload in Flutter?

I am uploading a file with help of Dio in flutter. To pause uploading i cancel the token. what should i do for upload that file again from pause?. any solution for remove that cancelled token or any other way..

to press button of stop uploading i called following code

token.cancel("Token Cancelled");

Upvotes: 2

Views: 2123

Answers (1)

Dhavalketu Darji
Dhavalketu Darji

Reputation: 91

I got the answer.

you just have to reinitialize you CancelToken() variable where you need. for example.

if(token.isCancelled){ token = new CancelToken(); }

Upvotes: 4

Related Questions