Recharge constructor
Recharge({
- required String path,
- void onReload()?,
Implementation
Recharge({required this.path, this.onReload}) {
assert(path != null, "Path cannot be null");
// This instance of watcher is going to be alive
// throughout the execution
_watcher = DirectoryWatcher(path);
// Start watching for file changes in the path
print("Starting recharge..");
_watcher.events.listen((event) async {
var name = event.type.toString().toUpperCase();
var path = event.path;
print("$name $path");
// Reload VM and fire onReload if it exists
if (await reload()) onReload?.call();
});
}