0

There are plenty of plugins demonstrating reading native data via dart streams. How to do the reverse, writing data back to native via IOSink? something like:

var ioSink = await _nativePlugin.writeSomething();
// Use the sink like writing a dart file.
ioSink.add('...');
await ioSink.flush();
Richard Heap
  • 48,344
  • 9
  • 130
  • 112
swlv
  • 73
  • 5
  • 1
    As an aside, `add()` takes a list of bytes. `write()` takes a string as you are trying to do here. To achieve this your `writeSomething` method would have to make a native call to prepare the native end to receive the bytes (and buffer them? play them?) and then return a class that simply implemented the IOSink (or StreamSink or StringSink) interface. On calls to add, that would just call another native method to pass the bytes to native where they could be buffered/played/whatever. – Richard Heap Mar 10 '23 at 22:21

0 Answers0