getValue method
Retrieves an enum value by its name, or handles built-in static
properties like values.
Returns a BridgedEnumValue for named values, a List<BridgedEnumValue>
for values, or null if not found.
Implementation
Object? getValue(String valueName) {
// GEN-044: Handle built-in enum static getters.
if (valueName == 'values') {
return enumValues;
}
// Check enum constants first
final enumValue = values[valueName];
if (enumValue != null) return enumValue;
// RC-8: Check static getters (e.g. WidgetState.any)
final staticGetter = staticGetters[valueName];
if (staticGetter != null) return staticGetter();
// RC-8: Fallback to runtime-registered static getters (via D4.registerEnumStaticGetter)
final runtimeGetter = D4.findEnumStaticGetter(name, valueName);
if (runtimeGetter != null) return runtimeGetter();
return null;
}