readFileStream method

  1. @override
Future<Stream<Uint8List>> readFileStream(
  1. String uri, {
  2. int? bufferSize,
  3. int? start,
})
override

Implementation

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