registerBitmapImage function Image Registry

Future<ImageDescriptor> registerBitmapImage({
  1. required ByteData bitmap,
  2. double imagePixelRatio = 1.0,
  3. double? width,
  4. double? height,
})

Register bitmap image to image registry. Returns ImageDescriptor that can be used to reference the bitmap when creating MarkerOptions. bitmap is the bytes of bitmap to be registered, in PNG format. Set imagePixelRatio if bitmap is larger tha it's intended display size. For example, if image width is 64 pixels and it need's to be displayed in 32 logical pixel size, set imagePixelRatio to 2. Optionally specify wanted logical pixel size with width or height. If only width or height is specified the other dimension is scaled according to the aspect ratio of the bitmap.

Throws ImageDecodingFailedException if bitmap decoding fails.

Implementation

Future<ImageDescriptor> registerBitmapImage({
  required ByteData bitmap,
  double imagePixelRatio = 1.0,
  double? width,
  double? height,
}) {
  return GoogleMapsNavigationPlatform.instance.imageRegistryAPI
      .registerBitmapImage(
        bitmap: bitmap.buffer.asUint8List(),
        imagePixelRatio: imagePixelRatio,
        width: width,
        height: height,
      );
}