XImageProbe class

Dimensions and a downscaled PNG of an image file, in one native round-trip that never decodes the image at full resolution.

Flutter's own route — instantiateImageCodec over the file's bytes — costs 4 bytes per source pixel even when the caller only wants a 200px thumbnail or the intrinsic size: ~190 MB for a 48-megapixel photo. That is several times the memory an app extension is allowed, so a share surface that describes photos it never displays at full size cannot use it.

Apple reads the header and asks ImageIO for a thumbnail (CGImageSourceCreateThumbnailAtIndex); Android measures with inJustDecodeBounds and decodes subsampled (inSampleSize); Windows reads the header and decodes through WIC's IWICBitmapScaler, with whichever codecs Windows has installed, HEIF among them where its extension is. All are bounded by the output size, not the source.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

supported → bool
Whether this platform has the native probe. Elsewhere the caller keeps its own decode path.
no setter

Static Methods

size(String path) → Future<({int height, int width})?>
Display dimensions alone, read from the header — no pixels decoded. Null when the file is not a decodable image.
thumbnail({required String path, required int maxLongest}) → Future<XImageThumbnail?>
Measures path and renders it down so its longest edge is at most maxLongest. An image already within that bound comes back at its own size rather than upscaled.