registerAlias abstract method
Registers an alias for an existing name in the registry.
Associates a new alias with an existing name, allowing the object
registered under name to be accessed using the alias as well.
Parameters:
name: The primary name that already exists in the registryalias: The alternative name to register for the primary name
Throws:
- InvalidArgumentException if
aliasis already registered as a primary name - InvalidArgumentException if
aliasis already registered as an alias - InvalidArgumentException if
namedoes not exist in the registry
Example:
final registry = MyAliasRegistry();
// First register a primary name
registry.registerPrimary('emailService');
// Then register aliases for it
registry.registerAlias('emailService', 'mailService');
registry.registerAlias('emailService', 'smtpService');
// Now the service can be accessed by any of these names
final service1 = registry.get('emailService');
final service2 = registry.get('mailService'); // Same as service1
final service3 = registry.get('smtpService'); // Same as service1
Implementation
void registerAlias(String name, String alias);