dio
dio copied to clipboard
flutter web console show Bad state: Future already completed
New Issue Checklist
- [x] I have searched for a similar issue in the project and found none
Issue Info
Info | Value | |
---|---|---|
Platform Name | web | |
Platform Version | - | |
Dio Version | 4.0.5 | |
Android Studio / Xcode Version | - (vscode&pkged) | |
Repro rate | all the time (100%) | |
Repro with our demo prj | - | |
Demo project link | - |
Issue Description and Steps
show error in broswer console: Bad state: Future already completed 4.0.4 doesnt have this error
Similar issue here (4.0.5 and 4.0.6). when a connectimeout options is set. This error come at last connecttimeout.
I can confirm - I am facing the same issue in my Interceptor. Removing the timeout options resolves the issue, though this is not a permanent fix ...
Same issue found~
I am also getting same issue
Error: Bad state: Future already completed at Object.throw_ [as throw] (http://localhost:57202/dart_sdk.js:5067:11) at _AsyncCompleter.new.completeError (http://localhost:57202/dart_sdk.js:35195:51) at http://localhost:57202/packages/dio/src/interceptors/log.dart.lib.js:651:25 at _RootZone.runUnary (http://localhost:57202/dart_sdk.js:40441:59) at _FutureListener.then.handleValue (http://localhost:57202/dart_sdk.js:35363:29) at handleValueCallback (http://localhost:57202/dart_sdk.js:35931:49) at Function._propagateToListeners (http://localhost:57202/dart_sdk.js:35969:17) at _Future.new.[_complete] (http://localhost:57202/dart_sdk.js:35809:25) at http://localhost:57202/dart_sdk.js:34915:30 at internalCallback (http://localhost:57202/dart_sdk.js:26619:11)
Can confirm as well. Downgrading to 4.0.4 or removing the timeout options resolves the issue.
Could it be that this is the culprit:
... elided ...
request = await reqFuture;
if (options.connectTimeout > 0) {
request = await reqFuture
.timeout(Duration(milliseconds: options.connectTimeout));
} else {
request = await reqFuture;
... elided ...
?
(See line 47).
It appears the call on line 47 is not needed since both conditions of the if do the call. Perhaps this is a duplicate?
Same issue in my project. As mentioned by @RootSoft, downgrading to 4.0.4 fixed it.
#1470 fixes this issue
昨晚发版,这个问题我一直没关注到是BrowserHttpClientAdapter的错误,排查了很久,五一第一天emo了,啊哈哈
I have the same problem dio: ^4.0.6
I have the same problem dio: ^4.0.6
My problem was solved because I called super in onRequest
I can confirm - I am facing the same issue in my Interceptor. Removing the timeout options resolves the issue, though this is not a permanent fix ...
same
Can confirm, too. Is in there since 4.0.5, 4.0.4 seems to be ok.
i seem to have the same issue on iOS and Android as well