getImageBytesFromUri method

  1. @override
Future<Uint8List?> getImageBytesFromUri(
  1. String uri
)
override

Reads the encoded image bytes referenced by a content:// uri, or returns null if it cannot be read.

Implementation

@override
Future<Uint8List?> getImageBytesFromUri(String uri) async {
  try {
    final bytes = await methodChannel.invokeMethod<Uint8List>(
      'getImageBytesFromUri',
      {'uri': uri},
    );
    return bytes;
  } on PlatformException {
    return null;
  } on MissingPluginException {
    return null;
  }
}