dio
dio copied to clipboard
Future already completed
When calling requests, the error has been thrown randomly.
Error: Bad state: Future already completed at Object.throw_ [as throw] (http://localhost:1234/dart_sdk.js:5067:11) at _AsyncCompleter.new.completeError (http://localhost:1234/dart_sdk.js:35195:51) at http://localhost:1234/packages/dio/src/interceptors/log.dart.lib.js:651:25 at _RootZone.runUnary (http://localhost:1234/dart_sdk.js:40441:59) at _FutureListener.then.handleValue (http://localhost:1234/dart_sdk.js:35363:29) at handleValueCallback (http://localhost:1234/dart_sdk.js:35931:49) at Function._propagateToListeners (http://localhost:1234/dart_sdk.js:35969:17) at _Future.new.[_complete] (http://localhost:1234/dart_sdk.js:35809:25) at http://localhost:1234/dart_sdk.js:34915:30 at internalCallback (http://localhost:1234/dart_sdk.js:26619:11)
_dio.interceptors.add(CustomInterceptors());
// ...
class CustomInterceptors extends Interceptor {
@override
void onError(DioError err, ErrorInterceptorHandler handler) async {
if (err.response != null) {
if (err.response!.statusCode == 401) {
// ...
handler.resolve(response);
} else {
handler.next(err);
}
}
return super.onError(err, handler);
}
}
Issue Info
| Info | Value |
|---|---|
| Platform Name | Chrome |
| Dio Version | 4.0.6 |
| Android Studio Version | 2021.1.1 Patch 2 |
Issue Description and Steps
Tried using flutter config --no-analytics. It didn't work.
change version to v4.0.4, same #1452 , wait for solute
same issue..
Same issue
Same issue...
我在web项目中,也会输出这个错误
Same issue...
Related to #1497 and PR #1496
Same issue.
Still happening in 4.0.6
Same issue.
Same issue
Same issue
same issue
same issue
Same issue
Same issue
Same issue
Same issue
https://stackoverflow.com/a/73824643/19475845
I have written one solution in StackOverflow this helps me to get rid of Error: Bad state: Future already completed error may help you also
+1
+1
Similar issues:
- https://github.com/flutterchina/dio/issues/1454
- https://github.com/flutterchina/dio/issues/1497
- https://github.com/flutterchina/dio/issues/1536
Open PRs:
- https://github.com/flutterchina/dio/pull/1470
- https://github.com/flutterchina/dio/pull/1496
- https://github.com/flutterchina/dio/pull/1550
- https://github.com/flutterchina/dio/pull/1565
+1
+1
+1
+1
same issue here
Same issue being faced by me
I have this issue as well
@AlexV525 why this issue is closed? Someone fix this bug?