我正在尝试在地图中添加自定义标记。
class Foo{
BitmapDescriptor myIcon;
Foo(){
BitmapDescriptor.fromAssetImage(
ImageConfiguration(size: Size(38, 38)), 'assets/marker.png')
.then((onValue) {
myIcon = onValue;
});
}
Marker getMarker(){
return Marker(markerId: MarkerId("123"),
icon: myIcon,
}
}
在pubspec.yaml中
assets:
- assets/marker.png
抛出以下错误:
E/MethodChannel#plugins.flutter.io/google_maps_0( 7524): Failed to handle method call
E/MethodChannel#plugins.flutter.io/google_maps_0( 7524): com.google.maps.api.android.lib6.common.apiexception.c: Failed to decode image. The provided image must be a Bitmap.