a14n / dart-google-maps

A library to use Google Maps JavaScript API v3 from Dart scripts.
Other
127 stars 65 forks source link

Exception on `GeocoderAddressComponent|get#types` #138

Open matanshukry opened 4 weeks ago

matanshukry commented 4 weeks ago

I am attempting to upgrade to google_maps version 8, and when using the types property on GeocoderAddressComponent, an error is thrown.

Browser: Chrome Reproducible steps:

  1. Clone this: https://github.com/matanshukry/flutter_google_places_sdk/tree/ex-not-caught , with the specific branch ex-not-caught (name indicates another issue, ignore it)
  2. Add your own google places key in constants.dart
  3. Run the app
  4. Search for a place - I was using bbb
  5. Once a place is found, click on it from the list and then click Fetch Place.
  6. Error should be thrown, and button disabled

Stacktrace in app:

Error
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3                                                                                                                                                                                                                                                                                                                                                                                                                                                              throw_
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1405:3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     _failedAsCheck
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1383:3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     _generalAsCheckImplementation
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1278:30                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    _installSpecializedAsCheck
packages/google_maps/src/generated/geocoder/geocoder_address_component.dart 33:46                                                                                                                                                                                                                                                                                                                                                                                                                                                        GeocoderAddressComponent.get$35types
packages/flutter_google_places_sdk_web/flutter_google_places_sdk_web.dart 277:31                                                                                                                                                                                                                                                                                                                                                                                                                                                         [_parseAddressComponent]
dart-sdk/lib/internal/iterable.dart 425:31                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               elementAt
dart-sdk/lib/internal/iterable.dart 354:26                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               moveNext
dart-sdk/lib/internal/cast.dart 61:30                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    moveNext
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 938:20                                                                                                                                                                                                                                                                                                                                                                                                                                                         next
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 342:14                                                                                                                                                                                                                                                                                                                                                                                                                                                                       of
dart-sdk/lib/core/iterable.dart 498:7                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    toList
packages/flutter_google_places_sdk_web/flutter_google_places_sdk_web.dart 228:17                                                                                                                                                                                                                                                                                                                                                                                                                                                         [_parsePlace]
packages/flutter_google_places_sdk_web/flutter_google_places_sdk_web.dart 211:46                                                                                                                                                                                                                                                                                                                                                                                                                                                         <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/js_allow_interop_patch.dart 201:30                                                                                                                                                                                                                                                                                                                                                                                                                                                           _callDartFunctionFast2
https://maps.googleapis.com/maps-api-v3/api/js/57/13/places_impl.js 33:498                                                                                                                                                                                                                                                                                                                                                                                                                                                               <fn>
https://maps.googleapis.com/maps-api-v3/api/js/57/13/places_impl.js 15:368                                                                                                                                                                                                                                                                                                                                                                                                                                                               e
https://maps.googleapis.com/maps-api-v3/api/js/57/13/common.js 110:81                                                                                                                                                                                                                                                                                                                                                                                                                                                                    c
https://maps.googleapis.com/maps/api/place/js/PlaceService.GetPlaceDetails?2sen&10e3&14m1&1sChIJV147nJRJHRURVy1e7MUXyLI&16m1&1sformatted_address%2Caddress_components%2Cbusiness_status%2Cplace_id%2Cgeometry%2Flocation%2Cname%2Copening_hours%2Cinternational_phone_number%2Cphotos%2Cplus_code%2Cprice_level%2Crating%2Ctypes%2Cuser_ratings_total%2Cutc_offset%2Cgeometry%2Fviewport%2Cwebsite&17m1&2e1&r_url=http%3A%2F%2Flocalhost%3A51591%2F&callback=_xdc_._90zsmi&key=AIzaSyAqBNXSXzKsIKlsIm-v0ppLL1YsD1TN9-g&token=62192 1:28  <fn>

Stacktrace in browser:

errors.dart:296 Uncaught Error
    at Object.throw_ [as throw] (errors.dart:296:3)
    at Object._failedAsCheck (rti.dart:1405:3)
    at dart_rti.Rti.new._generalAsCheckImplementation (rti.dart:1383:3)
    at dart_rti.Rti.new._installSpecializedAsCheck (rti.dart:1278:30)
    at Object.GeocoderAddressComponent$124get$35types [as GeocoderAddressComponent|get#types] (geocoder_address_component.dart:33:46)
    at [_parseAddressComponent] (flutter_google_places_sdk_web.dart:277:31)
    at MappedListIterable.new.elementAt (iterable.dart:425:31)
    at ListIterator.new.moveNext (iterable.dart:354:26)
    at CastIterator.new.moveNext (cast.dart:61:30)
    at JsIterator.next (operations.dart:938:20)
    at List.of (core_patch.dart:342:14)
    at _EfficientLengthCastIterable.new.toList (iterable.dart:498:7)
    at [_parsePlace] (flutter_google_places_sdk_web.dart:228:17)
    at flutter_google_places_sdk_web.dart:211:46
    at Object._callDartFunctionFast2 (js_allow_interop_patch.dart:201:30)
    at ret (js_allow_interop_patch.dart:98:15)
    at places_impl.js:33:498
    at Fka.e [as Gg] (places_impl.js:15:368)
    at Object.c [as _90zsmi] (common.js:110:81)
    at PlaceService.GetPlaceDetails?2sen&10e3&14m1&1sChIJV147nJRJHRURVy1e7MUXyLI&16m1&1sformatted_address%2Caddress_components%2Cbusiness_status%2Cplace_id%2Cgeometry%2Flocation%2Cname%2Copening_hours%2Cinternational_phone_number%2Cphotos%2Cplus_code%2Cprice_level%2Crating%2Ctypes%2Cuser_ratings_total%2Cutc_offset%2Cgeometry%2Fviewport%2Cwebsite&17m1&2e1&r_url=http%3A%2F%2Flocalhost%3A51591%2F&callback=_xdc_._90zsmi&key=AIzaSyAqBNXSXzKsIKlsIm-v0ppLL1YsD1TN9-g&token=62192:1:28
flodaniel commented 3 weeks ago

I can confirm this error: "Error: TypeError: Instance of 'JSArray<Object?>': type 'List<Object?>' is not a subtype of type 'List<String>'"