MagicTapirIntegration class
Glues magic's primitives (MagicForm, MagicRouter, Gate, Auth, Echo) into the tapir snapshot pipeline.
Host integration (the consumer gates with !kReleaseMode, so debug and
profile both carry it and release tree-shakes it):
if (!kReleaseMode) {
TapirPlugin.install();
MagicTapirIntegration.install();
}
Adds fourteen enrichers to TapirPlugin.enrichers (in insertion order;
later enrichers see the same Element, and nothing deduplicates keys: two
enrichers emitting the same key put both lines in the snapshot, so the
keys below stay distinct) and registers one navigate adapter
via TapirPlugin.registerNavigateAdapter so ext.tapir.navigate --route
drives GoRouter through MagicRouter instead of falling back to the
SystemNavigator broadcast:
- magicFormEnricher:
magicFormField: <name>for elements backed by aMagicFormDatatext controller. - magicNavigationEnricher:
magicRoute: <currentLocation>for every element when the router has resolved a route. - magicControllerEnricher:
magicControllerState: <Class>.<status>for the first registeredMagicStateMixincontroller. - magicFormErrorsEnricher:
magicFormErrors: <field>="<text>",...for elements under aMagicFormwhose controller carries server-sideValidatesRequestserrors matching the form's fields. Per-field error text is quoted and truncated to 80 chars (...-suffixed). - magicGateResultEnricher:
magicGateResult: <ability>.<allowed|denied>for the most recently cachedGateResultinGate.manager. - magicMiddlewareEnricher:
magicMiddleware: <name1,name2>for the active route's middlewares viaMagicRouter.currentRoute. - magicAuthUserEnricher:
magicAuthUser: <id>[:<displayName>]for the authenticated user surfaced byAuth.user. - magicControllerFlagsEnricher:
magicControllerFlags: <Class>.isLoading=<bool>,isSuccess=<bool>,isError=<bool>,isEmpty=<bool>for the first registeredMagicStateMixincontroller. - magicRouteParamsEnricher:
magicRouteParams: <k>=<v>,...for the active route's path + query parameters (path params first). - magicEchoConnectionEnricher:
magicEchoConnection: connected|reconnecting|disconnectedfor the current broadcast connection state. Null when the broadcasting provider is not registered. - magicGateResultsAllEnricher:
magicGateResultsAll: <ability>=<allowed|denied>,...for up to 5 most recently checked abilities. Null when no ability has been checked yet. - magicRecentHttpEnricher:
magicRecentHttp: GET /url 200 142ms,...for up to 5 most recent HTTP records captured by crumbs. URLs are truncated to 40 characters. Null when the crumbs buffer is empty or the crumbs-presence check fails. - magicRecentLogsEnricher:
magicRecentLogs: [WARN] msg,[ERROR] msgfor up to 3 most recent log records at or above WARNING level. Messages are truncated to 50 characters. Null when the crumbs buffer is empty or the crumbs-presence check fails. - magicRecentExceptionsEnricher:
magicRecentExceptions: HttpException at api.dart:142,...for up to 3 most recent exception records. Each entry surfaces the type plus the file:line extracted from the first stack frame. Null when the crumbs buffer is empty or the crumbs-presence check fails.
All fourteen enrichers are synchronous, return null on miss, and never
retain the Element across calls (the TapirSnapshotEnricher contract).
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 (matches
TapirPlugin.installsemantics). -
resetForTesting(
) → void -
Test-only reset. Drops all fourteen enrichers from
TapirPlugin.enrichers, clears the navigate adapter, cancels the Echo connection-state subscription, and clears the idempotency guard.