watcher
1.2.1, released 10 months ago by tools.dart.dev
Monitors file system changes and notifies when files are added, removed, or modified.
What it does
A file system watcher that monitors the contents of directories. It sends notifications when files have been added, removed, or modified across multiple platforms.
AI-written summary of version 1.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to monitor directory contents for additions, deletions, or modifications.
- Building developer tools or local file-processing utilities that react to file changes.
Skip it when
- You only need a one-time file picker interface instead of background observation.
Strengths
- Cross-platform support for Android, iOS, Windows, macOS, and Linux.
- Handles OS-specific quirks such as Windows buffer exhaustion and symlink loops.
Weaknesses
- May hit system watcher limits on Linux depending on configuration.
- Polling watchers may have limitations with low-resolution timestamps.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
No special setup or permissions documented.
import 'package:watcher/watcher.dart';
var watcher = DirectoryWatcher('path/to/directory');
watcher.events.listen((event) {
print(event);
});Alternatives
Packages that do the same job and could replace watcher.
- path_provider
Provides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
93Compare - file_selector_macos
macOS implementation of the file_selector plugin
82Compare - flutter_downloader
Plugin to create and manage background download tasks on Android and iOS.
80Compare - path_provider_android
Android implementation of the path_provider plugin for finding commonly used locations.
79Compare
Works with
Packages commonly used together with watcher: ones it builds on, ones built on it, and its own family.
- asyncwatcher depends on itUtility classes and helpers that extend Dart's async library.
- analyzerBuilt on watcherPerforms static analysis of Dart code for tool integration and embedding.
- build_runnerBuilt on watcherA build system for Dart code generation and modular compilation.
- build_daemonBuilt on watcherDaemon for running Dart builds in the background
- hotreloaderBuilt on watcherAutomatic hot code reloader for Dart projects that applies file changes to the running process.
- lean_builderBuilt on watcherLean Builder: a fast, efficient Dart build system for code generation
- slangBuilt on watcherType-safe i18n solution generating Dart translation classes from JSON, YAML, CSV, or ARB files
- build_testBuilt on watcherUtilities for unit testing Dart build_runner builders in memory