FileWatcher class abstract

Watches a file and emits WatchEvents when the file has changed.

Note that since each watcher only watches a single file, it will only emit ChangeType.MODIFY events, except when the file is deleted at which point it will emit a single ChangeType.REMOVE event and then close the stream.

If the file is deleted and quickly replaced (when a new file is moved in its place, for example) this will emit a ChangeType.MODIFY event.

Implemented types


FileWatcher(String file, {Duration? pollingDelay})
Creates a new FileWatcher monitoring file.


events Stream<WatchEvent>
The broadcast Stream of events that have occurred to the watched file or files in the watched directory.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isReady bool
Whether the watcher is initialized and watching for changes.
no setterinherited
path String
The path to the file or directory whose contents are being monitored.
no setterinherited
ready Future
A Future that completes when the watcher is initialized and watching for changes.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.