O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Watching the filesystem

It is very convenient to update a web form from any computer. It may also be useful to update it purely from the filesystem so that a standard text editor can be used or we can have the blog post content entirely automated.

The watcher package provides the functionality needed for this feature. This package is authored by the Dart team and is typically of the Dart philosophy of being a small focused library. The DirectoryWatcher class takes a path and notifies via events if any files have added, removed, or modified.

The Blog class constructor configures the path that is going to be watched by the DirectoryWatcher. Let's take a look at the following screenshot:

 DirectoryWatcher _changeMonitor; Blog(this._pathPosts, this._pathImgs) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required