load static method

Future<Image> load(
  1. String asset,
  2. Size size
)

Implementation

static Future<ui.Image> load(String asset, Size size) async {
  ByteData data = await rootBundle.load(asset);
  ui.Codec codec = await ui.instantiateImageCodec(
    data.buffer.asUint8List(),
    targetWidth: size.width.toInt(),
    targetHeight: size.height.toInt(),
  );
  ui.FrameInfo fi = await codec.getNextFrame();
  return fi.image;
}