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

Valid value range is empty: 0 #8

Open
prabhunath111 opened this issue Jan 3, 2020 · 6 comments
Open

Valid value range is empty: 0 #8

prabhunath111 opened this issue Jan 3, 2020 · 6 comments

Comments

@prabhunath111
Copy link

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: RangeError (index): Invalid value: Valid value range is empty: 0
E/flutter ( 8073): #0 List.[] (dart:core-patch/growable_array.dart:147:60)
E/flutter ( 8073): #1 GoogleMapsServices.getRouteCoordinates (package:uber_clone/requests/google_maps_requests.dart:11:30)
E/flutter ( 8073):
E/flutter ( 8073): #2 AppState.sendRequest (package:uber_clone/states/app_state.dart:116:46)
E/flutter ( 8073):
E/flutter ( 8073): #3 _MapState.build. (package:uber_clone/screens/home.dart:131:34)
E/flutter ( 8073): #4 EditableTextState._finalizeEditing (package:flutter/src/widgets/editable_text.dart:1255:14)
E/flutter ( 8073): #5 EditableTextState.performAction (package:flutter/src/widgets/editable_text.dart:1158:9)
E/flutter ( 8073): #6 _TextInputClientHandler._handleTextInputInvocation (package:flutter/src/services/text_input.dart:751:36)
E/flutter ( 8073):
E/flutter ( 8073): #7 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:401:55)
E/flutter ( 8073):
E/flutter ( 8073): #8 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:369:54)
E/flutter ( 8073): #9 _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binary_messenger.dart:110:33)
E/flutter ( 8073):
E/flutter ( 8073): #10 _invoke3. (dart:ui/hooks.dart:293:15)
E/flutter ( 8073): #11 _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 8073): #12 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 8073): #13 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 8073): #14 _invoke3 (dart:ui/hooks.dart:292:10)
E/flutter ( 8073): #15 _dispatchPlatformMessage (dart:ui/hooks.dart:154:5)

@maniecodes
Copy link

Go to https://console.developers.google.com/apis/dashboard
Click on the Menu -> google maps -> APIs
In the search bar type "Directions API" enable it.
Also, enable "Maps SDK for Android".

I hope this helps.

@afreen009
Copy link

No,.. it shows d same error . I have enabled it and then tested . In google map console under the directions api it shows requests 118 and errors 118. That means it is hitting the Api but thers no response ...

@Suraj-1411
Copy link

@afreen009
yes me too and i have also enabled Roads API and Distance matrix API then tested it shows the same error

E/flutter (24208): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: RangeError (index): Invalid value: Valid value range is empty: 0
E/flutter (24208): #0 List.[] (dart:core-patch/growable_array.dart:146:60)

But when i printed json Data which is stored in Values it Says

I/flutter (24208): {error_message: This IP, site or mobile application is not authorized to use this API key. Request received from IP address 27.6.58.172, with empty referer, routes: [], status: REQUEST_DENIED}

my App is not authorized in first error msg pair But I Enabled the API Key for only Android Apps in API Key restrictions and for me also its hitting the directions API and resulting in error but it is not sending any data so thats why the routes list is empty and thas Why we are getting this range error .I Understood this that why its getting error but i have enabled API key for My App and also registered my app by giving project name and SHA1 certificate Key

How to solve this error
Why its showing that my app is not authorized even when i registerd my app

@mgr2012
Copy link

mgr2012 commented May 28, 2020

I also face same error

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: RangeError (index): Invalid value: Valid value range is empty: 0
#0 List.[] (dart:core-patch/growable_array.dart:146:60)
#1 GoogleMapsServices.getRouteCoordinates (package:testapp/request/google_maps_requests.dart:14:28)

#2 AppState.sendRequest (package:testapp/states/app_state.dart:117:46)

#3 _MapState.build. (package:testapp/screens/map.dart:123:34)
#4 EditableTextState._finalizeEditing (package:flutter/src/widgets/editable_text.dart:1380:25)
#5 EditableTextState.performAction (package:flutter/src/widgets/editable_text.dart:1283:9)
#6 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1070:36)
#7 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:409:55)
#8 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:37<…>

@jamuflutterer
Copy link

image

yes me too have this problem and i have also enabled Roads API and Distance matrix API then tested it shows the same error

E/flutter (24208): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: RangeError (index): Invalid value: Valid value range is empty: 0
E/flutter (24208): #0 List.[] (dart:core-patch/growable_array.dart:146:60)

pls give the solution

@oguzhanbahadir
Copy link

E/flutter ( 8334): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: Exception: RangeError (index): Invalid value: Valid value range is empty: 0
E/flutter ( 8334): #0 NetworkUtil.getRouteBetweenCoordinates (package:flutter_polyline_points/src/network_util.dart:29:7)
E/flutter ( 8334):

im getting same problem. API is true and everything is okay. What is the problem? Any solution?

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