hmr 2.0.0 copy "hmr: ^2.0.0" to clipboard
hmr: ^2.0.0 copied to clipboard

Hot Module Replacement system specially designed for command-line Dart applications.

example/README.md

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 bundled hmr CLI doesn't expose what you need.
  • lib/counter.dart, lib/formatter.dart — library code reloaded on save.
  • tool/shape_change.dart — script that mutates Counter'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.

2
likes
150
points
259
downloads

Documentation

API reference

Publisher

verified publisherbaptistep.dev

Weekly Downloads

Hot Module Replacement system specially designed for command-line Dart applications.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

args, glob, mansion, path, vm_service, watcher, yaml

More

Packages that depend on hmr