Inject class

Puts a class in the Dox container. dox_builder finds it and writes lib/generated/container.g.dart, so you never register it by hand.

The constructor parameters come from the container, by type. Each isolate makes one instance, on first use. With @Inject(singleton: false) every get makes a new one.

@Inject()
class UserService {
  UserService(this.users);

  final UserRepository users;
}

Constructors

Inject({bool singleton = true})
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
singleton → bool
true (the default): one instance per isolate. false: a new instance each time.
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