Injector<T> class
A class that injects dependencies into a function.
You must provide T
if you wanna inject an abstract class.
Otherwise, it will be inferred from the create function.
Constructors
-
Injector.new(Function create, {ParamLocator? locator, Map<
String, dynamic> ? parameters, bool ignorePrivateTypes = true}) - Creates a new instance of Injector.
Properties
- create → Function
-
The
T
function to inject.final - hashCode → int
-
The hash code for this object.
no setterinherited
- hasParams → bool
-
Whether create has parameters.
If false, we can treat it as a ValueGetter of
T
.latefinal - ignorePrivateTypes → bool
-
Whether to ignore private types.
final
- isAsync → bool
-
Whether the create function is async.
no setter
- locator → ParamLocator?
-
The locate args by
Param
while injecting.final -
namedParams
→ List<
NamedParam> -
Named parameters of the constructor.
no setter
-
parameters
→ Map<
String, dynamic> ? -
The arguments values to use while injecting.
Example:
final
-
params
→ List<
Param> -
All parameters of the constructor.
no setter
-
positionalParams
→ List<
PositionalParam> -
Positional parameters of the constructor.
no setter
- rawType → String
-
The inferred
T
type of Injector. Fallbacks to returnType whenT
is generic.latefinal - returnType → String
-
The return type of create function.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
The return type of create function.
latefinal
Methods
-
call(
[Map< String, dynamic> ? parameters]) → FutureOr<T> - Performs the injection.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
splitParams(
String input) → List< String> -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultLocator ↔ ParamLocator?
-
The default ParamLocator to use. Applied to all Injector.
getter/setter pair