notifyN method

void notifyN(
  1. int n
)

Implementation

void notifyN(int n) {
  if (_closed || n <= 0) return;
  _epoch += n;
  var count = n;
  while (count > 0 && _waiters.isNotEmpty) {
    final c = _waiters.removeAt(0);
    if (!c.isCompleted) {
      c.complete();
      count--;
    }
  }
  if (count > 0) {
    _permits += count;
  }
}