next property

  1. @override
List<int>? get next
override

Blocks until the next full message is received, and then returns it.

Returns null at end of file.

Implementation

@override
List<int>? get next {
  try {
    List<int>? message;
    while (message == null) {
      var nextByte = _stdin.readByteSync();
      if (nextByte == -1) return null;
      message = _state.handleInput(nextByte);
    }
    return message;
  } catch (e) {
    // It appears we sometimes get an exception instead of -1 as expected when
    // stdin closes, this handles that in the same way (returning a null
    // message)
    return null;
  }
}