Gmaps LatLng not found in MouseEvent using angular.dart

Issue

Am working in an angular.dart project that uses gmaps.
And i want to get the LatLng value on map click.
My map.html :

<div id="map" ng-click="ctrl.mapClick($event)"></div>

My DartCtrl :

 void mapClick(e){
    print(e.runtimeType); //MouseEvent
    print(e.latLng); //error : Undifined function mapClick ...
 }

Any idea to get LatLng value without writing something like :

map.onClick.listen((e){
print(e.latLng);
});

*This happend in dartium so its not related to dart2js.
and think you ..

Solution

The MouseEvent returned is not the native one neither inherit from HTML’s MouseEvent, it’s ‘src/generated/core/events/mouse_event.dart’ so there s no possible way that my example work.
A better approach would be to create an NgDecorator that have a callback method that returns the special MouseEvent wish contains the LatLng

Answered By – youssef

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.