start method
starts the watcher
Implementation
Future<void> start() async {
if (_listener != null) {
return reset();
}
_listener = _watcher.events.listen((watchEvent) {
if (shouldExcludePath(watchEvent.path, excludePaths)) {
return;
}
// finishes the watcher
_hasRun = true;
for (final event in _beforeEvents) {
event(watchEvent.path);
}
for (final event in _events) {
event(watchEvent.path);
}
for (final event in _afterEvents) {
event(watchEvent.path);
}
});
await _watcher.ready;
}