i have got an issue when use interceptor on dio. it says "Bad state: Future already completed"
a
i have got an issue when use interceptor on dio. it says "Bad state: Future already completed"
r
hey @alpinjs
@nkshah2 can help here
n
Hey can you post the code for setting up the dio client? If you have multiple interceptors make sure to add the SuperTokens one last
a
no, i have use just spt interceptor
this is a service
and this one is dio api req
and error log
n
Hmm ill look into it, give me a bit
What version of dio are you using @alpinjs ?
a
dio: ^4.0.6
n
If you are using
4.0.6
try downgrading to
4.0.4
, this is a known issue in the latest version: https://github.com/flutterchina/dio/issues/1480
a
hımm. ok i'll try
thanks,
n
Happy to help, let us know if that solves the issue
a
Resolving dependencies... Because supertokens_flutter 0.1.0 depends on dio ^4.0.6 and no versions of supertokens_flutter match >0.1.0 <0.2.0, supertokens_flutter ^0.1.0 requires dio ^4.0.6. So, because beez_assistant_app depends on both dio 4.0.4 and supertokens_flutter ^0.1.0, version solving failed.
n
Hmm, can you open an issue about this? We will update the minimum versions for it. In the meantime you can try using
dependency_overrides
to work around this
a
ok
@nkshah2 hi, i have already downgrade dio v4.0.4 and reinstall supertoken_flutter 0.1.1 but it didn't work.
i get same error "StateError (Bad state: Future already completed)"
n
Hey @alpinjs, Can you post your full pubspec here? Using dio
4.0.4
and supertokens-flutter
0.1.1
works for me. This is from my pubspec:
Copy code
yaml
supertokens_flutter: ^0.1.1
dio: 4.0.4
Make sure you dont use
^4.0.4
when installing dio and fix it to that version instead
a
which flutter sdk version use ?
n
The one you’re using is correct
But just to make sure, post your pubspec
a
i am testing now again this versions
no it happened again
i have already used flutter clean & delete pubspec.lock
n
Ok, can you provide some detail on this issue? https://github.com/supertokens/supertokens-flutter/issues/16 Well take a look at it. Details about whether this happens for all network requests, the version of flutter you are using, any sample code you can provide would help
a
yes, i can
this is api service instance
and i call that service this method
is that details enough ? maybe we will online session about that issue ?
n
Ive repoened the issue, what version of flutter are you using?
a
Copy code
Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9944297138 (4 days ago) • 2023-02-08 15:46:04 -0800
Engine • revision 248290d6d5
Tools • Dart 2.19.2 • DevTools 2.20.1
n
Thanks! Well look into it
Hey @alpinjs, We've released a fix in version
0.1.2
(should be up for download soon, currently being analysed on pub.dev). Ive closed the Github issue for now, feel free to re-open it if the issue is not resolved
PS: We did test on both version for Dio (
4.0.4
and
4.0.6
) and it seems to work fine on both
a
ok . i will test it
3 Views