stream property

Stream<T> get stream

获取Dart对象数据流 Get the Dart object data stream

Implementation

Stream<T> get stream {
  if (_receivePort == null) {
    throw StateError('Channel is closed');
  }

  return _receivePort!.map((message) {
    if (_pointerToDart == null) {
      throw StateError(
          'PointerToDart converter is not set, please call setPointerToDart');
    }
    return _pointerToDart!(message as Pointer<Void>);
  });
}