magicControllerFlagsEnricher function

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

Enricher: emits magicControllerFlags: <Class>.isLoading=<bool>,isSuccess=<bool>,isError=<bool>,isEmpty=<bool> for the first registered MagicStateMixin controller in Magic.controllers.

Sibling to magicControllerEnricher: that enricher surfaces the active rxStatus enum name (success, loading, error, empty); this one surfaces the four built-in boolean projections in a stable declaration order so an agent does not need to derive them from the status string.

Returns null when no MagicStateMixin controller is registered.

Implementation

String? magicControllerFlagsEnricher(Element element, RefRegistry refs) {
  for (final Object controller in Magic.controllers) {
    if (controller is! MagicController) continue;
    final _ControllerFlags? flags = _readControllerFlags(controller);
    if (flags == null) continue;
    final String className = controller.runtimeType.toString();
    return 'magicControllerFlags: $className.'
        'isLoading=${flags.isLoading},'
        'isSuccess=${flags.isSuccess},'
        'isError=${flags.isError},'
        'isEmpty=${flags.isEmpty}';
  }
  return null;
}