a14n / dart-google-maps

A library to use Google Maps JavaScript API v3 from Dart scripts.
Apache License 2.0
130 stars 66 forks source link

List<dynamic> is not List<QueryAutocompletePrediction?>? in getQueryPredictions() #106

Closed Vinzent03 closed 2 years ago

Vinzent03 commented 2 years ago

By executing the following code:

import 'package:google_maps/google_maps_places.dart';

AutocompleteService().getQueryPredictions(
    QueryAutocompletionRequest()..input = "any_street",
    (res, status) {
        print("This gets never executed");
    },
);

I get the following error

Error: Expected a value of type 'List<QueryAutocompletePrediction?>?', but got one of type 'List<dynamic>'
    at Object.throw_ [as throw] (http://localhost:8081/dart_sdk.js:5063:11)
    at Object.castError (http://localhost:8081/dart_sdk.js:5022:15)
    at Object.cast [as as] (http://localhost:8081/dart_sdk.js:5347:17)
    at dart.NullableType.new.as (http://localhost:8081/dart_sdk.js:6907:60)
at http://localhost:8081/packages/google_maps/src/generated/google_maps_places.js.g.dart.lib.js:542:228
    at Object._checkAndCall (http://localhost:8081/dart_sdk.js:5270:16)
    at Object.dcall (http://localhost:8081/dart_sdk.js:5275:17)
    at ret (http://localhost:8081/dart_sdk.js:62306:21)
    at https://maps.googleapis.com/maps-api-v3/api/js/47/4/intl/de_ALL/places_impl.js:30:450
    at Qha.e [as i] (https://maps.googleapis.com/maps-api-v3/api/js/47/4/intl/de_ALL/places_impl.js:25:114)
    at Object.c [as _sz8alv] (https://maps.googleapis.com/maps-api-v3/api/js/47/4/intl/de_ALL/common.js:98:253)
    at https://maps.googleapis.com/maps/api/place/js/AutocompletionService.GetQueryPredictionsJson?1sl&4sde-DE&15e3&21m1&2e1&callback=_xdc_._sz8alv&key=MYKEY&token=130757:1:28

I'm using version ^5.3.0 and added <script src="https://maps.googleapis.com/maps/api/js?key=MYKEY&libraries=places"></script> to my index.html

a14n commented 2 years ago

Fixed by 5d3e0af and available in 6.0.0

a14n commented 2 years ago

(And thanks for the report)

Vinzent03 commented 2 years ago

Thanks can confirm it's working.