Skip to content

definev/fmon

Repository files navigation

fmon

A file-watching daemon that automatically hot reloads a running Dart or Flutter app through the Dart VM Service — save a file, see it reload, no IDE required.

fmon is framework-agnostic: it only speaks the VM Service reloadSources RPC, which every Dart and Flutter app exposes. (When the app is Flutter, fmon additionally calls ext.flutter.reassemble if it's registered, so the UI rebuilds — but it never depends on Flutter or its daemon protocol.)

Install

dart pub global activate fmon   # once published
# or, from a clone:
dart pub get

Usage

Supervise mode — fmon launches and watches your app:

fmon bin/main.dart

Attach mode — reload an app you started yourself (incl. flutter run):

# grab the "VM service is listening on http://…" URI it prints, then:
fmon --uri http://127.0.0.1:8181/abcdef=/

Attach via a service-info file — reuse an already-running VM without copying the URI. Start your app so it writes its VM Service URI to a file, then point fmon at that file (it waits for the file/URI to appear):

# pure Dart:
dart run --enable-vm-service --write-service-info=file:///tmp/svc.json bin/main.dart
# Flutter:
flutter run --vmservice-out-file=/tmp/svc.json

# in another terminal:
fmon --service-info /tmp/svc.json

Monorepo / melos workspaces

In a melos or pub-workspace monorepo, fmon can watch every package's lib/ and pubspec.yaml so editing any package reloads the app that depends on it:

fmon --workspace apps/runner/bin/main.dart

This is auto-enabled when a melos.yaml or a pub workspace: is present, so usually you don't even pass the flag. Package discovery is, in order: melos.yaml packages: globs → root pubspec workspace: list → a scan of packages/ and apps/ (override with --workspace-root). A pubspec.yaml change in any package triggers pub get + restart.

What triggers what

Change Action
*.dart source hot reload (reloadSources + optional reassemble)
pubspec.yaml dart pub get, then restart (supervise mode)
ignored/other files nothing

Interactive keys

r reload now · R restart app · s stats · q quit

Options

--uri, --watch, --include, --exclude, --debounce, --port, --polling, --[no-]reassemble, --[no-]pub-get, --notify, --verbose. See fmon --help.

Config file

Drop an fmon.yaml in your project root (see fmon.example.yaml). CLI flags override it.

How it works

  1. Acquire a VM Service URI (launch dart run --enable-vm-service … or attach via --uri).
  2. Watch source paths with package:watcher (debounced, glob-filtered).
  3. On change, call reloadSources for each isolate group via package:vm_service, report success/compile errors, and reassemble Flutter UIs when available.

About

A file-watching CLI daemon that automatically triggers hot reload of a running Dart or Flutter app via the Dart VM Service. Supports supervise, attach, and service-info modes, with melos/pub workspace discovery for monorepos.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages