BitmapDescriptor.fromBytes не работает на iOS, но хорошо работает на Android

#flutter #dart #google-maps-flutter

#flutter #dart #google-карты-flutter

Вопрос:

Я пытаюсь использовать BitmapDescriptor.fromBytes для значка маркера Google maps. Использование хорошо работает на Android и показывает значок в маркере карты. Вот мой код для логической функции :

 void convertToImg({BuildContext context,List<DataEvent> data}) async{
 for(int i=0;i<data.length;i  ) {
   final http.Response res = await http.get(data[i].category.icon);
   DrawableRoot root = await svg.fromSvgBytes(res.bodyBytes, null);
   ui.Picture picture = root.toPicture(size: Size(16, 16));
   ui.Image image = await picture.toImage(16, 16);
   ByteData byteData = await image.toByteData(format: ui
       .ImageByteFormat.png);
   listImg.add(byteData.buffer.asUint8List());
 }
}
  

Вот мой код маркеров :

 void addMarker({List<DataEvent> data}) {
 markers = Iterable.generate(data.length, (index) {
   return Marker(
     markerId: MarkerId("${data[index].id}"),
     position: LatLng(
       double.parse(data[index].location.split(',')[0]),
       double.parse(data[index].location.split(',')[1])
     ),
     infoWindow: InfoWindow(
       title: data[index].name,
       snippet: data[index].description,
       anchor: Offset(1.5, 1.5)
     ),
     icon: BitmapDescriptor.fromBytes(listImg[index])
   );
 });
}
  

Кто-нибудь знает почему?

Вот для обоих результатов. Значок похож на маленькую белую каракатицу