remove method

Future<void> remove(
  1. String path
)

Removes path from the watch list and stops watching it.

Throws WatcherError if path is not currently being watched.

await watcher.remove('/var/log');

Implementation

Future<void> remove(String path) async {
  final resolved = p.canonicalize(path);
  final sub = _subs.remove(resolved);
  if (sub == null) {
    throw WatcherError('Path is not being watched', path: resolved);
  }
  await sub.cancel();
}