attach method

Stream<Uint8List> attach(
  1. Stream<List<int>> dataResponse
)

Attach this RxAudio to the Frame's dataResponse characteristic stream. If this RxAudio was created with streaming: true then the returned broadcast Stream will produce elements continuously, otherwise it will be a single subscription stream that produces a single Uint8List element containing the entire audio clip received. Both types of Stream are Done when the finalChunkFlag is received from Frame indicating the end of the audio feed

Implementation

Stream<Uint8List> attach(Stream<List<int>> dataResponse) {
  // TODO check for illegal state - attach() already called on this RxAudio etc?
  // might be possible though after a clean close(), do I want to prevent it?
  return streaming ?
    _audioDataStreamResponse(dataResponse) :
    _audioDataResponse(dataResponse);
}