I know how to use a png image as image for a map marker:
static Future<Uint8List> getBytesFromAsset(
{required String path, required int width}) async {
final ByteData data = await rootBundle.load(path);
final ui.Codec codec = await ui
.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
final ui.FrameInfo fi = await codec.getNextFrame();
final Uint8List bytes =
(await fi.image.toByteData(format: ui.ImageByteFormat.png))!
.buffer
.asUint8List();
return bytes;
}
and then use the bytes with BitmapDescriptor.fromBytes(bytes)
.
How can I do the same with a pre-installed icon, such as Icons.camera_alt_outlined
?
As a side question. In google maps we often see marker in a form of a pin with an icon in it. Is there out there a package that can achieve such a thing?
I know if I do it by myself I will have to get deep into canvas and other stuff. It is just a nice to have for my project.