loadImage static method

Future<Image> loadImage(
  1. String assetPath
)

Utility method for getting an UI Image from a resource in the assts. @param assetPath path to retrieve the asset.

Implementation

static Future<Image> loadImage(String assetPath) async {
  final ByteData img = await rootBundle.load(assetPath);
  //BrotherUtils.printBytesHex(img.buffer.asUint8List(), 16);
  final Completer<Image> completer = new Completer();
  decodeImageFromList(new Uint8List.view(img.buffer), (Image img) {
    return completer.complete(img);
  });
  return completer.future;
}