menu
scope package
documentation
scope.dart
scope.dart
dark_mode
light_mode
scope
library
Classes
Scope
Creates a Scope providing dependency injection to your call stack.
ScopeKey
<
T
>
The only purpose of
ScopeKey
s is to be globally unique so that they can be used to uniquely identify injected values.
ScopeKey
s are opaque – you are not supposed to read any other information from them except t heir identity.
Functions
hasScopeKey
<
T
>
(
ScopeKey
<
T
>
key
)
→
bool
Returns true if
key
is contained within the current
Scope
or an ancestor
Scope
isNullable
<
T
>
(
)
→
bool
Returns true if
T
was declared as a nullable type (e.g. String?)
isWithinScope
(
)
→
bool
Returns true if the caller is running within a
Scope
use
<
T
>
(
ScopeKey
<
T
>
key
, {
T
withDefault
()?
})
→ T
Returns the value provided for
key
, or the keys default value if no value was provided.
Exceptions / Errors
CircularDependencyException
<
T
>
Thrown by
use
when called inside a
Scope.single
or
Scope.sequence
callback and the
keys
factories try to mutually inject each other.
DuplicateDependencyException
<
T
>
Thrown if an attempt is made to inject the same
ScopeKey
twice.
MissingDependencyException
<
T
>
Thrown by
use
when no value has been registered in the
Scope
for
_key
and it has no default value.
scope package
documentation
scope.dart
scope
package
Libraries
scope
scope library