size static method

Future<({int height, int width})?> size(
  1. String path
)

Display dimensions alone, read from the header — no pixels decoded. Null when the file is not a decodable image.

Implementation

static Future<({int width, int height})?> size(String path) async {
  if (!supported) return null;
  final result = await _channel.invokeMapMethod<String, Object?>('size', {
    'path': path,
  });
  final width = (result?['width'] as num?)?.toInt();
  final height = (result?['height'] as num?)?.toInt();
  if (width == null || height == null) return null;
  return (width: width, height: height);
}