Factory class final

Annotation used to mark a function as a dependency factory.

Factories are used in dependency injection to create instances of a dependency every time they are called. This is sometimes referenced as "transient" or "non-singleton" instances.

When using a factory, a method extension on the Locator is generated to provide an easy way to call the factory method.

Example usage:

@Factory()
MyService createMyService() => MyService();

class MyService {
  // class implementation
}

Because of a design decision of the underlying dependency injection library, factories can have a maximum of 2 parameters. If you need more parameters, consider using an object as parameter.

Constructors

Factory()
const

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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