stream method

  1. @override
Stream<T> stream()
override

Returns a Stream of values ending once DisconnectedError is yielded.

Implementation

@override
Stream<T> stream() async* {
  while (true) {
    final rec = await recv();
    switch (rec) {
      case Ok(:final ok):
        yield ok;
      case Err(:final err):
        switch (err) {
          case DisconnectedError():
            return;
          default:
        }
    }
  }
}