Singleton class
A class decorator that marks a class as a singleton.
Singletons have only one instance throughout the application.
The dependencies parameter is an optional iterable of types that the singleton depends on. These dependencies will be automatically resolved and injected when the singleton is instantiated.
Example usage:
@Singleton(dependencies: [Database])
class UserRepository {
// ...
}
Properties
-
dependencies
→ Iterable<
Type> ? -
final
- 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