crumbs library
Magic ↔ crumbs integration adapter barrel.
Import this file when your app uses both magic and crumbs
and wants the MagicCrumbsIntegration watchers wired into CrumbsPlugin.
Consumers MUST add magic_devtools as a regular dependency (lib/main.dart
imports it under !kReleaseMode, so a dev_dependency would trip
depend_on_referenced_packages); it depends on magic and crumbs, so
transitive resolution does not happen through magic itself.
Host integration (debug-only in lib/main.dart). MagicCrumbsIntegration
MUST run AFTER Magic.init() because MagicHttpFacadeAdapter resolves
the NetworkDriver via the IoC container. CrumbsPlugin itself
installs BEFORE Magic.init(), and so does the opt-in ExceptionWatcher
that catches Magic boot errors:
if (!kReleaseMode) {
CrumbsPlugin.install();
CrumbsPlugin.registerWatcher(ExceptionWatcher());
CrumbsPlugin.registerWatcher(DumpWatcher());
}
await Magic.init(configFactories: [...]);
if (!kReleaseMode) {
MagicCrumbsIntegration.install();
}
See src/crumbs_integration.dart for the concrete
MagicCrumbsIntegration class, its 5 Magic watchers, and
MagicHttpFacadeAdapter.
Classes
- MagicCacheWatcher
-
CrumbsWatcherfor Magic's cache facade. - MagicCrumbsIntegration
- Glues magic's Http / Model / Cache facades into the crumbs store.
- MagicEventWatcher
-
CrumbsWatcherfor magic's app-event surface (auth, db, gate definitions). Excludes model lifecycle events (owned by MagicModelWatcher) and the gate-result event (owned by MagicGateWatcher) to keep each record on a single channel. - MagicGateWatcher
-
CrumbsWatcherfor magic's gate-result event. Subscribes to the canonicalGateAccessChecked(covers both allow and deny outcomes viaallowed: bool); the convenienceGateAccessDeniedevent is NOT subscribed to because it would double-record every denial. - MagicHttpFacadeAdapter
-
CrumbsHttpAdapterthat captures every request flowing through Magic'snetworkdriver and feedsCrumbsStore.recordHttp. - MagicModelWatcher
-
CrumbsWatcherthat subscribes toModelCreated,ModelSaved,ModelDeletedand feedsCrumbsStore.recordModel. - MagicQueryWatcher
-
CrumbsWatcherfor magic'sQueryExecutedevent (dispatched by QueryBuilder after every SQL run). Captures sql + bindings + timeMs + connection into aQueryRecord; surfaces viacrumbs:queriesCLI /crumbs_queriesMCP tool.