iconFromAssets static method

Future<MapImageIcon> iconFromAssets({
  1. required String path,
  2. Point? anchor,
  3. Point? labelOrigin,
  4. Point? origin,
  5. Size? size,
  6. Size? scaledSize,
})

return an icon from the assets.

Implementation

static Future<MapImageIcon> iconFromAssets(
    {required String path,
    Point? anchor,
    Point? labelOrigin,
    Point? origin,
    Size? size,
    Size? scaledSize}) async{
  final String format=path.split('.').last;
  final file=await rootBundle.load(path);
  var b64=base64Encode(Uint8ClampedList.view(file.buffer));
  b64='data:image/$format;base64,$b64';
  return MapImageIcon.fromUrl(
    url: b64,
    anchor: anchor,
    labelOrigin: labelOrigin,
    origin: origin,
    size: size,
    scaledSize: scaledSize,

  );
}