ServiceDefinition<T> class

Defines a factory for the service and whether or not it is a singleton.

Annotations
  • @immutable

Constructors

ServiceDefinition(T factory(IocContainer container), {bool isSingleton = false, void dispose(T service)?})
Defines a factory for the service and whether or not it is a singleton.
const

Properties

dispose → (void Function(T service)?)
The dispose method that is called when you dispose the scope
final
factory → T Function(IocContainer container)
The factory that creates the instance of the service and can access other services in this container
final
hashCode int
The hash code for this object.
no setterinherited
isSingleton bool
If true, only once instance of the service will be created and shared for for the lifespan of the app
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asSingleton() ServiceDefinition<T>
Creates a new instance of the service definition as a singleton
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