dispose method

void dispose()

Cancel ongoing search and close the stream

Implementation

void dispose() {
  _subscription?.cancel();
  if (_ongoingSearch != null && !_ongoingSearch!.isCompleted) {
    _ongoingSearch!.complete();
  }
  _controller.close();
  _ongoingSearch = null;
}