fakeData method

Stream<Uint8List> fakeData()

Implementation

Stream<Uint8List> fakeData() {
  void start() {
    _running = true;
    if (_buffer.length > 0) {
      _buffer.forEach((data) {
        _controller.add(data);
      });
      _buffer.clear();
    }
  }

  void stop() {
    _running = false;
  }

  // _controller = StreamController(
  //     onListen: start, onPause: stop, onResume: start, onCancel: stop);
  _controller = StreamController.broadcast(onListen: start, onCancel: stop);

  return _controller.stream;
}