When JS method returns an object, its type is NativeJavaScriptObject instead of the declared Dart type. For example in CircleMarker, the method getLatLng is declared as:
external LatLng getLatLng();
var c = CircleMarker();
var pos = c.getLatLng(); // pos type is NativeJavaScriptObject instead of LatLng
getLatLng() is declared to return LatLng, but it returns NativeJavaScriptObject.
This object fails the type checks if it is passed to function that expects LatLng.
var positions = [];
positions.add(pos); // error! Type mismatch
When JS method returns an object, its type is NativeJavaScriptObject instead of the declared Dart type. For example in CircleMarker, the method getLatLng is declared as: external LatLng getLatLng();
var c = CircleMarker(); var pos = c.getLatLng(); // pos type is NativeJavaScriptObject instead of LatLng
getLatLng() is declared to return LatLng, but it returns NativeJavaScriptObject. This object fails the type checks if it is passed to function that expects LatLng.
var positions =[];
positions.add(pos); // error! Type mismatch