Factory class

Basic component factory that creates components using registered types and factory functions.

Example

var factory = Factory();

factory.registerAsType(
    Descriptor('mygroup', 'mycomponent1', 'default', '*', '1.0'),
    MyComponent1
);
factory.register(
    Descriptor('mygroup', 'mycomponent2', 'default', '*', '1.0'),
    (locator) {
        return MyComponent2();
    }
);

factory.create(Descriptor('mygroup', 'mycomponent1', 'default', 'name1', '1.0'))
factory.create(Descriptor('mygroup', 'mycomponent2', 'default', 'name2', '1.0'))

See Descriptor See IFactory

Implemented types
Implementers

Constructors

Factory()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

canCreate(dynamic locator) → dynamic
Checks if this factory is able to create component by given locator.
override
create(dynamic locator) → dynamic
Creates a component identified by given locator.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(dynamic locator, dynamic factory(dynamic locator)) → void
Registers a component using a factory method.
registerAsType(dynamic locator, dynamic type) → void
Registers a component using its type (a constructor function).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited