ScopeType enum

Defines the lifecycle scope of a component within a dependency injection container.

This determines whether a single instance should be reused or a new instance created each time.

Example

void configureScope(ScopeType scope) {
  if (scope == ScopeType.SINGLETON) {
    print("A single shared instance will be used.");
  } else if (scope == ScopeType.PROTOTYPE) {
    print("A new instance will be created each time.");
  }
}
Inheritance
Available extensions

Values

SINGLETON → const ScopeType

A single shared instance is used throughout the application.

const ScopeType(0)
PROTOTYPE → const ScopeType

A new instance is created each time it is requested.

const ScopeType(1)

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
value int
Numeric representation of the scope type.
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

Static Methods

fromValue(int value) ScopeType
Returns the ScopeType that corresponds to the given integer value.
valueOf(String name) ScopeType
Returns the ScopeType that matches the given name.

Constants

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