RegisterAs enum
Enum to specify the type of dependency registration.
This enum defines all possible ways to register dependencies with GetIt, providing flexibility for different use cases and performance requirements.
Values
- singleton → const RegisterAs
-
Creates instance immediately and reuses it.
Use this when you want the instance to be created right away and shared across all consumers. Good for configuration objects or services that are expensive to create but cheap to use.
- factory → const RegisterAs
-
Creates new instance each time.
Use this when you need a fresh instance every time. Good for objects that should not be shared or have state that changes between uses.
- lazySingleton → const RegisterAs
-
Creates instance on first use, then reuses it.
Use this when you want the instance to be created only when first needed and then shared. Good for services that are expensive to create but you want to defer the creation cost.
- factoryAsync → const RegisterAs
-
Creates async instance each time.
Use this when you need a new async instance every time. Good for objects that require async initialization and should not be shared.
- lazySingletonAsync → const RegisterAs
-
Creates async instance on first use, then reuses it.
Use this when you want the async instance to be created only when first needed and then shared. Good for services that require async initialization but you want to defer the creation cost.
- singletonAsync → const RegisterAs
-
Creates async instance immediately and reuses it.
Use this when you want the async instance to be created right away and shared across all consumers. Good for services that require async initialization and are expensive to create but cheap to use.
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<
RegisterAs> - A constant List of the values in this enum, in order of their declaration.