removeFirst method

T? removeFirst()

删除第一个的元素, 并发射

Implementation

T? removeFirst() {
  if (_subject.isClosed) {
    L.w('IO在close状态下请求发送数据');
    return null;
  }

  final copied = List.of(latest);

  final T firstElement = copied.first;
  if (latest.isNotEmpty) {
    _subject.add(copied..removeAt(0));
  }
  return firstElement;
}