canCreate method
Checks if this factory is able to create component by given locator.
This method searches for all registered components and returns a locator for component it is able to create that matches the given locator. If the factory is not able to create a requested component is returns null.
locator
a locator to identify component to be created. Return a locator for a component that the factory is able to create.
Implementation
@override
dynamic canCreate(locator) {
for (var index = 0; index < _registrations.length; index++) {
var registration = _registrations[index];
var thisLocator = registration.locator;
if (thisLocator == locator || (thisLocator.equals(locator))) {
return thisLocator;
}
}
return null;
}