watchFiles function
Watches for changes in Dart files within the current directory and its subdirectories.
When a Dart file is modified, the onFileChange
callback is triggered.
Implementation
void watchFiles(Function onFileChange) {
var watcher = DirectoryWatcher(Directory.current.path);
watcher.events.listen((event) {
if (event.type == ChangeType.MODIFY && event.path.endsWith('.dart')) {
onFileChange();
}
});
}