loadUiImageResize static method
Implementation
static Future<ui.Image> loadUiImageResize(
String assetPath, {
required int width,
required int height,
bool fromAsset = true,
}) async {
final Uint8List data;
if (fromAsset) {
final byteData = await rootBundle.load(assetPath);
data = byteData.buffer.asUint8List();
} else {
data = await _readFileByte(assetPath);
}
final codec = await ui.instantiateImageCodec(
data,
targetHeight: height,
targetWidth: width,
allowUpscaling: true,
);
final image = (await codec.getNextFrame()).image;
return image;
}