uber_clone_with_flutter icon indicating copy to clipboard operation
uber_clone_with_flutter copied to clipboard

Valid value range is empty: 0

Open prabhunath111 opened this issue 5 years ago • 6 comments

[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)

prabhunath111 avatar Jan 03 '20 14:01 prabhunath111

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.

maniecodes avatar Feb 06 '20 12:02 maniecodes

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 ...

afreen009 avatar May 01 '20 05:05 afreen009

@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

Suraj-1411 avatar May 06 '20 09:05 Suraj-1411

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<…>

mgr2012 avatar May 28 '20 04:05 mgr2012

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

jamuflutterer avatar Sep 21 '20 07:09 jamuflutterer

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?

oguzhanbahadir avatar Sep 25 '20 21:09 oguzhanbahadir