useFactory property

Function? useFactory
final

A factory function to invoke when token is injected.

For static forms of injection (i.e. compile-time), the deps argument is not required, but to use with ReflectiveInjector it is required unless you have no arguments:

ReflectiveInjector.resolveAndCreate([
  Provider(Foo, useFactory: (Bar bar) => new Foo(bar), deps: [Bar]),
]);

Implementation

final Function? useFactory;