dispose method

  1. @visibleForTesting
Future<void> dispose()

Send a done event and disposes the stream

It is not necessary to call this function as the stream is disposed automatically. But is useful for testing, in cases where otherwise the tester keeps waiting until done.

Implementation

@visibleForTesting
Future<void> dispose() async {
  if (_stream != null) {
    _monitor.onStreamDispose(runtimeType.toString());
    await _stream!.close();
    _stream = null;
  }
}