Closed dietmarebner closed 5 years ago
Thanks for filing an issue. _googlemaps-3.3.3 fixes it.
Thanks, Alexandre.
I think there's something missing with the codecs business. remove_at and set_at take two arguments (index and previous element) and return a IndexAndElement
Something like the snippet below works but this looks like auto-generated code so this should probably fixed elsewhere.
class _Undefined { const _Undefined(); }
const _undefined = _Undefined();
final codecOneOrTwoArgFunction =
FunctionCodec
When MVCArray
contains JsObject you should provide a codec
at its creation to make it know how to encode/decode the elements. For instance:
MVCArray<LatLng>(elements: latlngList, codec: JsInterfaceCodec((o) => LatLng.created(o)));
As dietmarebner commented above subscribing to onRemoveAT and onSetAt are still broken. You can replicate this by attempting to run the tests for MVCArray:
pub run test -p chrome test/gmaps_test.dart
...
00:06 +2: MVCArray works
inserted at 0
00:06 +2 -1: MVCArray works [E]
NoSuchMethodError: method not found: 'call'
Receiver: Closure '_closure0'
Arguments: [0, "aa"]
...
A potential culprit is that the handler in _Event.addListener only takes a single optional argument. It's very difficult to trace this with the code generation. https://github.com/a14n/dart-google-maps/blob/f4d7e0f8a149d0773df02aff5db2e05c0055d37b/lib/src/core/events/event.dart#L27
@drewwarren Thanks for your feedback. The issue should be addressed by 0cbd411 publish in version 3.4.1
Bindings for MVCArray expose three streams, i.e., onInsertAt, onRemoveAT, and onSetAt.
The first one is correct but the other two wrap the click event rather than 'remove_at' and 'set_at' respectively. This is in dart-google-maps/lib/src/google_maps_src.g.dart:2889.
There's a test for this in dart-google-maps/test/gmaps_test.dart but that doesn't actually fail if the event handlers don't get executed.