tapir library
Magic ↔ tapir integration adapter barrel.
Import this file when your app uses both magic and tapir
and wants the MagicTapirIntegration enrichers wired into TapirPlugin.
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 tapir, so
transitive resolution does not happen through magic itself.
Host integration (debug-only in lib/main.dart). MagicTapirIntegration
MUST run AFTER Magic.init() because its enrichers query
Magic.find<X>() for form / nav / controller state. TapirPlugin
itself installs BEFORE Magic.init() so the snapshot pipeline is
live during Magic boot:
if (!kReleaseMode) {
TapirPlugin.install();
}
await Magic.init(configFactories: [...]);
if (!kReleaseMode) {
MagicTapirIntegration.install();
}
See src/tapir_integration.dart for the concrete MagicTapirIntegration
class and 14 enrichers.
Classes
- MagicTapirIntegration
- Glues magic's primitives (MagicForm, MagicRouter, Gate, Auth, Echo) into the tapir snapshot pipeline.
Functions
-
magicAuthUserEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicAuthUser: <id>[:<displayName>]for the authenticated user. -
magicControllerEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicControllerState: <ControllerClass>.<rxStatus>for the firstMagicStateMixin-bearing controller registered viaMagic.put. -
magicControllerFlagsEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicControllerFlags: <Class>.isLoading=<bool>,isSuccess=<bool>,isError=<bool>,isEmpty=<bool>for the first registeredMagicStateMixincontroller inMagic.controllers. -
magicEchoConnectionEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicEchoConnection: connected|reconnecting|disconnectedfor the current broadcast connection state. -
magicFormEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicFormField: <name>whenelementis backed by a TextEditingController owned by aMagicFormDatain an ancestorMagicForm. -
magicFormErrorsEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicFormErrors: <field>="<text>",...for elements under aMagicFormwhose controller carries server-sideValidatesRequestserrors matching the form's own field set. -
magicGateResultEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicGateResult: <ability>.<allowed|denied>for the most recently cachedGateResultinGate.manager. -
magicGateResultsAllEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicGateResultsAll: <ability>=<allowed|denied>,...for up to 5 of the most recently checked Gate abilities. -
magicMiddlewareEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicMiddleware: <name1,name2>for the active route's resolved middleware names. -
Enricher: emits
magicRoute: <currentLocation>when the router has a resolved location. -
magicRecentExceptionsEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicRecentExceptions: <Type> at <file.dart>:<line>,...for up to 3 most recent records inCrumbsStore.recentExceptions. -
magicRecentHttpEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicRecentHttp: <METHOD> <url> <status> <durationMs>ms,...for up to 5 most recent records inCrumbsStore.recentHttp. -
magicRecentLogsEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicRecentLogs: [<shortLevel>] <message>,...for up to 3 most recent log records at or above WARNING level inCrumbsStore.recentLogs. -
magicRouteParamsEnricher(
Element element, RefRegistry refs) → String? -
Enricher: emits
magicRouteParams: <k>=<v>,...for the active route's path parameters followed by its query parameters.