maybeLoad static method
Implementation
static Future<SlideAsset?> maybeLoad(File file) async {
if (!await file.exists()) {
return null;
}
final bytes = await file.readAsBytes();
final codec = await ui.instantiateImageCodec(bytes);
final frame = await codec.getNextFrame();
return SlideAsset(
path: file.path,
bytes: AssetFileBytes.fromBytes(bytes),
width: frame.image.width.toDouble(),
height: frame.image.height.toDouble(),
);
}