magicNavigationEnricher function

String? magicNavigationEnricher(
  1. Element element,
  2. RefRegistry refs
)

Enricher: emits magicRoute: <currentLocation> when the router has a resolved location.

Element-independent (every snapshot row gets the same annotation when the router is built), but kept as a per-element enricher so the YAML emitter consistently surfaces the active route next to each ref.

Returns null when MagicRouter.currentLocation is null (router not built yet, or no route has resolved).

Implementation

String? magicNavigationEnricher(Element element, RefRegistry refs) {
  final String? location = MagicRouter.instance.currentLocation;
  if (location == null || location.isEmpty) return null;
  return 'magicRoute: $location';
}