defineBridgeAlias method
GEN-078: Registers a class alias that maps aliasName to an existing
bridged class registered under targetName.
This allows deprecated type alias names (e.g., MaterialStateProperty)
to resolve to their canonical bridged class (e.g., WidgetStateProperty).
Implementation
void defineBridgeAlias(String aliasName, String targetName) {
// Walk the scope chain to find the target bridged class
BridgedClass? target;
Environment? current = this;
while (current != null) {
target = current._bridgedClasses[targetName];
if (target != null) break;
current = current._enclosing;
}
if (target == null) {
Logger.warn(
"[Environment] Cannot register alias '$aliasName' -> '$targetName': "
"target class not found",
);
return;
}
_bridgedClassesOrNew[aliasName] = target;
Logger.debug(
"[Environment] Defined bridge alias: $aliasName -> $targetName",
);
}