Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: RangeError (index): Invalid value: Only valid value is 0: 1#0 List.[] (dart:core-patch/growable_array.dart:145:60) #303

Closed
1 task
Q14 opened this issue May 17, 2019 · 8 comments

Comments

@Q14
Copy link

Q14 commented May 17, 2019

New Issue Checklist

  • I have searched for a similar issue in the project and found none

Issue Info

Info Value
Platform Name ios 模拟器
Platform Version 12.0
Dio Version 2.1.0
Android Studio / Xcode Version Android Studio 3.3.2
Repro rate e.g. all the time (100%) / sometimes x% / only once
Repro with our demo prj e.g. does it happen with our demo project?
Demo project link e.g. link to a demo project that highlights the issue

Issue Description and Steps

Unhandled Exception: DioError [DioErrorType.DEFAULT]: RangeError (index): Invalid value: Only valid value is 0: 1#0 List.[] (dart:core-patch/growable_array.dart:145:60)
#1 RequestOptions.uri (package:dio/src/options.dart:217:29)
#2 DefaultHttpClientAdapter.fetch (package:dio/src/adapter.dart:120:67)

#3 Dio._makeRequest (package:dio/src/dio.dart:735:46)

#4 Dio._request.. (package:dio/src/dio.dart:707:22)
#5 _rootRunUnary (dart:async/zone.dart:1132:38)
#6 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#7 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#8 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#9 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#10 Future._complete (dart:async/future_impl.dart:473:7)
#11 _SyncCompleter.complete (dart:async/<…>

@MonkeyInWind
Copy link

+1
dart写的接口 postman web都可以调用

@MonkeyInWind
Copy link

找到原因了 android模拟器把宿主机ip指定为了10.0.2.2 所以不要访问电脑的ip 要访问10.0.2.2这个ip @Q14

@lilong7676
Copy link

楼上正解,只要url无效,就会报这个错。

@stale
Copy link

stale bot commented Aug 17, 2019

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.

@stale stale bot added the stale label Aug 17, 2019
@dxjdqc
Copy link

dxjdqc commented Aug 21, 2019

找到原因了 android模拟器把宿主机ip指定为了10.0.2.2 所以不要访问电脑的ip 要访问10.0.2.2这个ip @Q14

请问下,我用的是真机测试也报这个错,怎么解决呢

@stale stale bot removed the stale label Aug 21, 2019
@amreniouinnovent
Copy link

my base URL in dio was empty "" now solved

@wendux
Copy link
Contributor

wendux commented Sep 21, 2019

如果该问题还存在,请按模板补全信息,然后给出最小的可复现步骤后再重新打开

:octocat: From gitme Android

@wendux wendux closed this as completed Sep 21, 2019
@hjJunior
Copy link

hjJunior commented Jan 25, 2020

I got the same error, but in my case, it was because my base URL in dio was missing the http prefix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants