MagicCrumbsIntegration class
Glues magic's Http / Model / Cache / Log facades into the crumbs store.
Host integration (debug-only):
if (!kReleaseMode) {
CrumbsPlugin.install();
MagicCrumbsIntegration.install();
}
Registers seven units with CrumbsPlugin:
- MagicHttpFacadeAdapter ; wraps Magic's
networkdriver with aMagicNetworkInterceptorthat feedsCrumbsStore.recordHttp(oracle's reuse-pattern decision kept inside magic). - MagicModelWatcher ; subscribes to
ModelCreated,ModelSaved,ModelDeletedand feedsCrumbsStore.recordModel. - MagicCacheWatcher ; subscribes to
CacheHit,CacheMiss,CachePut,CacheForgetandCacheFlushand feedsCrumbsStore.recordCache. - MagicEventWatcher ; subscribes to the curated set of magic auth /
db / gate-definition events and feeds
CrumbsStore.recordEventwith an empty payload: the record carries the event type only. - MagicGateWatcher ; subscribes to
GateAccessCheckedand feedsCrumbsStore.recordGatewith the canonical gate result shape (single dynamicargumentswrapped intoList<Object?>, user id stringified). - MagicQueryWatcher ; subscribes to
QueryExecutedand feedsCrumbsStore.recordQuery. - MagicLogWatcher ; wraps the container's
'log'manager so everyLog.*call after install also feedsCrumbsStore.recordLog.
The adapter and the six watchers are public and exported from
package:magic_devtools/crumbs.dart, so a host can register a subset
itself; MagicCrumbsIntegration.install registers all seven at once.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- isInstalled → bool
-
Whether install has been called at least once.
no setter
Static Methods
-
install(
) → void - Idempotent install. Safe to call multiple times within the same isolate lifetime.
-
resetForTesting(
) → void -
Test-only reset. Drops the idempotency guard, puts back the log
manager MagicLogWatcher wrapped, AND restores the three
cross-package function pointers (
pendingHttpCountReader,recentLogsReader,recentExceptionsReader) to their tapir-side missing-crumbs defaults so downstream tests that assert "graceful-empty" behavior do not see leaked bindings from a prior install call. The contract on each pointer is set-once-per-isolate during install + reset-on-resetForTesting.