hmr 2.0.0
hmr: ^2.0.0 copied to clipboard
Hot Module Replacement system specially designed for command-line Dart applications.
hmr example #
A minimal CLI app demonstrating hmr hot reload.
Run #
From this directory:
dart pub get
dart run hmr
Edit lib/counter.dart or lib/formatter.dart and save — the running
process picks up the change in milliseconds.
Layout #
bin/main.dart— entrypoint, prints a ticking counter.bin/custom_hmr.dart— a custom HMR runner built from the library's building blocks (strategy + watcher + filters + presenter). Copy this as a starting point when the bundledhmrCLI doesn't expose what you need.lib/counter.dart,lib/formatter.dart— library code reloaded on save.tool/shape_change.dart— script that mutatesCounter's shape to exercise the hot-restart fallback.
Custom runner #
dart run bin/custom_hmr.dart
Same hot-reload behaviour as dart run hmr, but with a tiny inline
Presenter that prefixes every event with a timestamp. Use it as a
template for your own output format, custom hot keys, alternate file
watcher, etc.