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(Function create, {ParamLocator? locator, Map<Symbol, 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. Ex: _MyPrivateClass.
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<Symbol, 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 when T is generic.
latefinal
returnType String
The original return type of create function.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
The deferred return type of create function.
latefinal

Methods

call([Map<Symbol, 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