readFile method

  1. @override
Future<Stream<Uint8List>> readFile(
  1. Uri uri, {
  2. int? bufferSize,
})
override

Implementation

@override
Future<Stream<Uint8List>> readFile(Uri uri, {int? bufferSize}) async {
  var session = _nextSession();
  var channelName = await methodChannel.invokeMethod<String>('readFile', {
    'fileUri': uri.toString(),
    'session': session.toString(),
    'bufferSize': bufferSize
  });
  if (channelName == null) {
    throw Exception('Unexpected empty channel name from `readFile`');
  }
  var stream = EventChannel(channelName);
  return stream.receiveBroadcastStream().map((e) => e as Uint8List);
}