decodeImageFile function
Decode an image from a file path. For platforms that do not support dart:io, such as the web, this will return null. WARNING Since this will check the image data against all known decoders, it is much slower than using an explicit decoder.
Implementation
Future<Image?> decodeImageFile(String path, {int? frame}) async {
final bytes = await readFile(path);
if (bytes == null) {
return null;
}
final decoder = findDecoderForNamedImage(path);
if (decoder != null) {
return decoder.decode(bytes, frame: frame);
}
return decodeImage(bytes, frame: frame);
}