Configurable class

Lets the container inject an object it did not create, such as a Flutter State.

Some objects are created by a framework, not by the container, yet need beans and settings. Mark the class @Configurable(): the generator writes an injector for its @Autowired and @Value members, and the object calls autowireBean on itself once it exists. Spring weaves such classes with AspectJ so that new triggers the injection; Dart has no weaving, so the call is explicit.

@Configurable()
class ProfileScreenState {
  @Autowired()
  late final UserService users;

  @Value(r'${app.title}')
  late final String title;
}

// Flutter created the state; fill in its beans and settings.
final state = ProfileScreenState();
context.autowireCapableBeanFactory.autowireBean(state);

Spring (Java):

@Configurable
class ProfileScreenState {
  @Autowired UserService users;
}
// with AspectJ weaving: new ProfileScreenState() is injected, or
context.getAutowireCapableBeanFactory().autowireBean(state);

Constructors

Configurable()
Marks the class as injectable from outside the container.
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