更改自定义标记的大小 Google-地图

Change size of a custom marker Google-Maps

我创建了一个应用程序,当您点击地图时,它会在 Google 地图中显示一个自定义标记,但我找不到更改标记大小的方法...有人知道吗我该怎么做?

这是 m 代码的一部分:

  createMarker(context) {
    if (customIcon == null) {
      ImageConfiguration configuration = createLocalImageConfiguration(context);
      BitmapDescriptor.fromAssetImage(configuration, 'assets/Boot-Pfeil2.png')
          .then((icon) {
        setState(() {
          customIcon = icon;
        });
      });
    }
  }


Marker m = Marker(
    markerId: MarkerId('1'),
    icon: customIcon,
    position: cordinate);
 setState(() {
    markers.add(m);
 });

基于问题:

import 'dart:ui' as ui;
Future<Uint8List> getBytesFromAsset(String path, int width) async {
  ByteData data = await rootBundle.load(path);
  ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
  ui.FrameInfo fi = await codec.getNextFrame();
  return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List();
}

然后:

final Uint8List markerIcon = await getBytesFromAsset('assets/Boot-Pfeil2.png', 100);
final Marker marker = Marker(icon: BitmapDescriptor.fromBytes(markerIcon));