Autowired class

Autowired allows to inject and find dependencies based on GetX dependency management.

Note: Unnamed contracture will be considered, also only non optional required parameters will be injected (founded).

To find dependency with a tag you must annotate it with Autowired and specify the tag you search for.

@Autowired()
class UserViewModel {
  UserViewModel(this._userRepository, this._userService);

  @Autowired(tag: '_userRepositoryTag')
  final UserRepository _userRepository;

  final UserService _userService;
}
Annotations
  • @Target(<TargetKind>{TargetKind.classType, TargetKind.field})

Constructors

Autowired.new({Type? as, String? tag, bool callDependenciesBefore = false})
Register and call a lazy dependency.
const
Autowired.async({Type? as, String? tag, bool permanent = false, bool callDependenciesBefore = false})
Register and call an async dependency.
const
Autowired.put({Type? as, String? tag, bool permanent = false, bool callDependenciesBefore = false})
Register and call dependency.
const

Properties

as Type?
The type to bind your implementation to, typically, an abstract class which is implemented by the annotated class.
final
callDependenciesBefore bool
Weather the Dependencies Bindings will be called before the registration of actual dependency.
final
hashCode int
The hash code for this object.
no setterinherited
permanent bool
Weather the registered dependency should be kept the in memory.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag String?
Use a tag as an "id" to create multiple records of the same dependency the tag doesn't conflict with the same tags used by other dependencies Types.
final

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