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:

  1. magicFormEnricher: magicFormField: <name> for elements backed by a MagicFormData text controller.
  2. magicNavigationEnricher: magicRoute: <currentLocation> for every element when the router has resolved a route.
  3. magicControllerEnricher: magicControllerState: <Class>.<status> for the first registered MagicStateMixin controller.
  4. magicFormErrorsEnricher: magicFormErrors: <field>="<text>",... for elements under a MagicForm whose controller carries server-side ValidatesRequests errors matching the form's fields. Per-field error text is quoted and truncated to 80 chars (...-suffixed).
  5. magicGateResultEnricher: magicGateResult: <ability>.<allowed|denied> for the most recently cached GateResult in Gate.manager.
  6. magicMiddlewareEnricher: magicMiddleware: <name1,name2> for the active route's middlewares via MagicRouter.currentRoute.
  7. magicAuthUserEnricher: magicAuthUser: <id>[:<displayName>] for the authenticated user surfaced by Auth.user.
  8. magicControllerFlagsEnricher: magicControllerFlags: <Class>.isLoading=<bool>,isSuccess=<bool>,isError=<bool>,isEmpty=<bool> for the first registered MagicStateMixin controller.
  9. magicRouteParamsEnricher: magicRouteParams: <k>=<v>,... for the active route's path + query parameters (path params first).
  10. magicEchoConnectionEnricher: magicEchoConnection: connected|reconnecting|disconnected for the current broadcast connection state. Null when the broadcasting provider is not registered.
  11. magicGateResultsAllEnricher: magicGateResultsAll: <ability>=<allowed|denied>,... for up to 5 most recently checked abilities. Null when no ability has been checked yet.
  12. 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.
  13. magicRecentLogsEnricher: magicRecentLogs: [WARN] msg,[ERROR] msg for 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.
  14. 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.install semantics).
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.