maybeLoad static method

Future<SlideAsset?> maybeLoad(
  1. File file
)

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(),
  );
}