sizeOf static method
How big the image file at path is, without decoding all of it.
Implementation
static Future<(int, int)> sizeOf(String path) async {
final buffer = await ui.ImmutableBuffer.fromUint8List(
await File(path).readAsBytes(),
);
final descriptor = await ui.ImageDescriptor.encoded(buffer);
try {
return (descriptor.width, descriptor.height);
} finally {
descriptor.dispose();
buffer.dispose();
}
}