notifyListeners method

void notifyListeners()
inherited

Implementation

void notifyListeners() {
  _notifyDepth++;
  try {
    // Snapshot only the length, not the contents: this is the hot path
    // (hit on every Terminal.write()) and must not allocate in the steady
    // state.
    final length = _listeners.length;
    for (var i = 0; i < length; i++) {
      _listeners[i]?.call();
    }
  } finally {
    _notifyDepth--;
    if (_notifyDepth == 0 && _compactionPending) {
      _compactionPending = false;
      _compactIfNeeded();
    }
  }
}