Bean class
Bean method annotation
Indicates that a method produces a bean to be managed by the Dire DI container.
This annotation is typically used within @Configuration classes.
Example:
@Configuration()
class AppConfig {
@Bean()
@Singleton()
HttpClient createHttpClient() {
return HttpClient()..timeout = Duration(seconds: 30);
}
@Bean()
@Qualifier('logger')
Logger createLogger() {
return Logger('app');
}
}
Properties
- destroyMethod → String?
-
Optional destroy method to call before disposal
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initMethod → String?
-
Optional initialization method to call after instantiation
final
- name → String?
-
Optional name for the bean
final
- 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