plus method

int? plus([
  1. int value = 1
])

加一个值 并发射

Implementation

int? plus([int value = 1]) {
  if (_subject.isClosed) {
    L.w('IO在close状态下请求发送数据');
    return null;
  }

  int result;
  if (_remainder != null) {
    result = (latest! + value).remainder(_remainder!);
    if (_min != null) {
      result = math.max(_min!, result);
    }
  } else if (_max != null) {
    result = math.min(latest! + value, _max!);
  } else {
    result = latest! + value;
  }
  if (!_subject.isClosed) {
    _subject.add(result);
  }
  return result;
}