Marqueur personnalisé Google Maps Flutter
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();
}
// init marker icon
final Uint8List markerIcon2 =
await getBytesFromAsset('assets/images/m1.png', 99);
final Uint8List markerIcon1 =
await getBytesFromAsset('assets/images/camion.png', 139);
teste1 = BitmapDescriptor.fromBytes(markerIcon2);
teste2 = BitmapDescriptor.fromBytes(markerIcon1);
// show marker
Marker(icon: teste1)
Marker(icon: teste2)
Dead Dormouse