allowAliasOverriding method
Determine whether alias overriding is allowed.
Subclasses can override this method to control alias overriding behavior.
When returns false, attempting to register an alias that already exists
for a different name will throw an exception.
Returns:
true if alias overriding is allowed (default), false otherwise
Example:
class StrictAliasRegistry extends SimpleAliasRegistry {
@override
bool allowAliasOverriding() => false; // Disallow overriding
}
final registry = StrictAliasRegistry();
registry.registerAlias('service1', 'alias1');
try {
registry.registerAlias('service2', 'alias1'); // Throws exception
} on IllegalStateException catch (e) {
print('Alias overriding not allowed');
}
Implementation
@protected
bool allowAliasOverriding() => true;