getUint8List method

Future<Uint8List> getUint8List()

Implementation

Future<Uint8List> getUint8List() async {
  if (fallbackAssetPackage != null) {
    final byteData = await rootBundle.load(fallbackAssetPackage != null
        ? 'packages/$fallbackAssetPackage/$fallbackAssetPath'
        : fallbackAssetPath!);
    final resizedImage = await _resizeImage(
      byteData.buffer.asUint8List(),
      width.toInt(),
      height.toInt(),
    );
    return resizedImage;
  } else {
    final Uint8List markerImage = await createImageFromWidget(
      Directionality(
        textDirection: TextDirection.ltr,
        child: SizedBox(
          width: width,
          height: height,
          child: widget,
        ),
      ),
      waitToRender: Duration(milliseconds: 500),
      view: WidgetsBinding.instance.platformDispatcher.views.first,
    );
    final resizedImage =
        await _resizeImage(markerImage, width.toInt(), height.toInt());
    return resizedImage;
  }
}