imageFromAssetBundle function
Future<ImageProvider>
imageFromAssetBundle(
- String key, {
- AssetBundle? bundle,
- bool cache = true,
- PdfImageOrientation? orientation,
- double? dpi,
- PdfBaseCache? pdfCache,
Load an image from an asset bundle key.
Implementation
Future<ImageProvider> imageFromAssetBundle(
String key, {
AssetBundle? bundle,
bool cache = true,
PdfImageOrientation? orientation,
double? dpi,
PdfBaseCache? pdfCache,
}) async {
bundle ??= rootBundle;
final bytes = await bundle.load(key);
return MemoryImage(
bytes.buffer.asUint8List(bytes.offsetInBytes, bytes.lengthInBytes),
orientation: orientation,
dpi: dpi,
);
}