fromBytes static method

BitmapDescriptor fromBytes(
  1. Uint8List byteData, {
  2. Size? size,
})

Creates a BitmapDescriptor using an array of bytes that must be encoded as PNG. On the web, the size parameter represents the physical size of the bitmap, regardless of the actual resolution of the encoded PNG. This helps the browser to render High-DPI images at the correct size. size is not required (and ignored, if passed) in other platforms.

Implementation

static BitmapDescriptor fromBytes(Uint8List byteData, {Size? size}) {
  assert(byteData.isNotEmpty,
      'Cannot create BitmapDescriptor with empty byteData');
  return BitmapDescriptor._(<Object>[
    _fromBytes,
    byteData,
    if (kIsWeb && size != null)
      <Object>[
        size.width,
        size.height,
      ]
  ]);
}