ServiceLifeTime enum

Service life-time

Inheritance
Available extensions

Values

singleton → const ServiceLifeTime

Singleton, where only one instance exists in the same root service container.

Singleton services are released by service containers if they are created by service containers, otherwise you have to release it.

scoped → const ServiceLifeTime

Scoped, the instances are not the same in different scoped service containers

Scoped services are released by service containers. Different instances will be created in different scopes, and in the root service container, requests to scoped services are not allowed, and an assert error will be thrown in development mode.

transient → const ServiceLifeTime

Transient, a new instance is created with each request.

Each time an transient service is requested, a new instance is created. Transient services are not released by service containers, but are released by their consumers after they are obtained from service containers.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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

Constants

values → const List<ServiceLifeTime>
A constant List of the values in this enum, in order of their declaration.