Future _completePoll()

in lib/src/directory_watcher/polling.dart [175:190]


  Future<void> _completePoll() async {
    // Any files that were not seen in the last poll but that we have a
    // status for must have been removed.
    var removedFiles = _lastModifieds.keys.toSet().difference(_polledFiles);
    for (var removed in removedFiles) {
      if (isReady) _events.add(WatchEvent(ChangeType.REMOVE, removed));
      _lastModifieds.remove(removed);
    }

    if (!isReady) _readyCompleter.complete();

    // Wait and then poll again.
    await Future.delayed(_pollingDelay);
    if (_events.isClosed) return;
    _poll();
  }