close method
Closes the watcher and releases all resources.
After calling close, the events and errors streams are closed and the watcher cannot be reused.
await watcher.close();
Implementation
Future<void> close() async {
if (_closed) return;
_closed = true;
for (final sub in _subs.values) {
await sub.cancel();
}
_subs.clear();
await _eventController.close();
await _errorController.close();
}