Closed deedub-g closed 2 years ago
Thanks for the report. 6f23fa6 fixes the issue. Version 6.1.1 is available with this fix.
(Side note: you can use the geo package to encode/decode paths without js-interop const PolylineCodec().encode(....)
or const PolylineCodec().decode(....)
)
Thanks for the fix. Note that the cast
used to fix this leads to exceptions if you try to pass the decode
result into a google maps method that wants a List.cast()
aren't very compatible with the js-interop. For example this error will be thrown if you try to pass the decode result into PolylineOptions().path
.
I'm currently working around this by explicitly calling .toList() on the result of .decode
-- resulting in a raw List opposed to the special "CastList" object that gets returned by cast: https://github.com/dart-lang/sdk/blob/b33e376857cde2dbed171e0f447e4dc792a784b7/sdk/lib/core/list.dart#L292.
I'd suggest patching.
I filed https://github.com/dart-lang/sdk/issues/49271 . Depending on the answer I'll see if I change every place a .cast() is used.
Example error
Uncaught Error: Expected a value of type 'List<google.maps.LatLng?>?', but got one of type 'List<dynamic>'
Note that the error did not occur for me when running dart 2.16.1 -- it only started after upgrading to dart 2.17.3.
Reproduction steps:
pubspec.yaml
web/main.dart
Then run
webdev serve
and access the web-app. I imagine you could reproduce as well from the examples in this repo, but it wasn't obvious to me how to actually run them ^_^At a glance it looks like this will involve some js_wrapping changes which aren't as trivial so I don't think I'll try drafting a fix unless I get more free time.
Full error stack: