create method
Creates a component identified by given locator.
locator
a locator to identify component to be created. Return the created component.
Trows a CreateException if the factory is not able to create the component.
Implementation
@override
dynamic create(locator) {
for (var index = 0; index < _registrations.length; index++) {
var registration = _registrations[index];
var thisLocator = registration.locator;
if (thisLocator == locator || (thisLocator.equals(locator))) {
try {
return registration.factory(locator);
} catch (ex) {
if (ex is CreateException) rethrow;
throw CreateException(null, 'Failed to create object for ' + locator)
.withCause(ex);
}
}
}
return null;
}