Dio: DioError [DioErrorType.DEFAULT]: RangeError (index): Invalid value: Only valid value is 0: 1

Created on 11 Mar 2020  ·  10Comments  ·  Source: flutterchina/dio

New Issue Checklist

  • [ ] I have searched for a similar issue in the project and found none solution
#flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-UZ)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 3.6)
[!] IntelliJ IDEA Ultimate Edition (version 2019.3.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.42.1)
[✓] Connected device (1 available)

Issue Description and Steps

I/flutter ( 9377): error: DioError [DioErrorType.DEFAULT]: RangeError (index): Invalid value: Only valid value is 0: 1
I/flutter ( 9377): #0      List.[] (dart:core-patch/growable_array.dart:149:60)
I/flutter ( 9377): #1      RequestOptions.uri (package:dio/src/options.dart:301:29)
I/flutter ( 9377): #2      DefaultHttpClientAdapter.fetch (package:dio/src/adapters/io_adapter.dart:35:72)
I/flutter ( 9377): #3      DioMixin._dispatchRequest (package:dio/src/dio.dart:919:46)
I/flutter ( 9377): <asynchronous suspension>
I/flutter ( 9377): #4      DioMixin._request._interceptorWrapper.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:dio/src/dio.dart:849:37)
I/flutter ( 9377): #5      DioMixin.checkIfNeedEnqueue (package:dio/src/dio.dart:1117:22)
I/flutter ( 9377): #6      DioMixin._request._interceptorWrapper.<anonymous closure>.<anonymous closure> (package:dio/src/dio.dart:846:22)
I/flutter ( 9377): #7      new Future.<anonymous closure> (dart:async/future.dart:176:37)
I/flutter ( 9377): #8      _rootRun (dart:async/zone.dart:1122:38)
I/flutter ( 9377): #9      _CustomZone.run (dart:async/zone.dart:1023:19)
I/flutter ( 9377): #10     _CustomZone.runGuarded (dart:async/zone.dart:925:7)
I/flutter ( 9377): #11     _CustomZone.bindCallbackGuarded.<anonymous

dio: ^3.0.9

stale

Most helpful comment

lol, I used to meet it. Maybe it missing domain ,ex abc.xyz , and you only request '/api/...'

All 10 comments

I am also facing the same issue, any solution?

I have not found a solution yet

lol, I used to meet it. Maybe it missing domain ,ex abc.xyz , and you only request '/api/...'

lol, I used to meet it. Maybe it missing domain ,ex abc.xyz , and you only request '/api/...'

this is the solution, had the same issue

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

still having the issue

I am also facing the same issue, any solution?

For those who got this error (this burns my few hours, LOL). Adding more detail from @lhhuu 's answer.
Make sure you set domain or domain has full path with http or https
EG:

http://abc.xyz

As an improvement the error could detail that the issue is related to the domain scheme, let me know if you cannot add it to do so by my self.

For me it was because after adding dependency I did not reinstalled the whole app

Was this page helpful?
0 / 5 - 0 ratings