foodSink property

StreamSink<Food>? get foodSink

The sink side of the Food Controller

This the output stream that you use when you want to play asynchronously live data. This StreamSink accept two kinds of objects :

  • FoodData (the buffers that you want to play)
  • FoodEvent (a call back to be called after a resynchronisation)

Example:

This example shows how to play Live data, without Back Pressure from Flutter Sound

await myPlayer.startPlayerFromStream(codec: Codec.pcm16, numChannels: 1, sampleRate: 48000);

myPlayer.foodSink.add(FoodData(aBuffer));
myPlayer.foodSink.add(FoodData(anotherBuffer));
myPlayer.foodSink.add(FoodData(myOtherBuffer));
myPlayer.foodSink.add(FoodEvent((){_mPlayer.stopPlayer();}));

Implementation

StreamSink<Food>? get foodSink =>
    _foodStreamController != null ? _foodStreamController!.sink : null;