dart-lang / watcher

A file system watcher library for Dart.
https://pub.dev/packages/watcher
BSD 3-Clause "New" or "Revised" License
138 stars 35 forks source link

How to close DirectoryWatcher #142

Open realth000 opened 1 year ago

realth000 commented 1 year ago

Hi!

I'm using watcher: ^1.0.2 and I wonder how to close a DirectoryWatcher?

The close method in the source code can not be used on a DirectoryWatcher object.

2023-04-06_23-07

Also there's no method mentioned in the official document.

mudlee commented 1 year ago

Would be nice to know this here too... :)

dipin-arora commented 8 months ago
 var watcher = DirectoryWatcher(directory);
 StreamSubscription subscription = watcher.events.listen((event) {
    // do stuff
 });
 subscription.cancel();