providers property

List<Object> providers
final

The set of injectable objects that are visible to the directive and its light DOM children.

Example

Here is an example of a class that can be injected:

class Greeter {
  String greet(String name) => 'Hello ${name}!';
}

@Directive(
  selector: 'greet',
  providers: const [ Greeter])
class HelloWorld {
  final Greeter greeter;

  HelloWorld(this.greeter);
}

Implementation

final List<Object> providers;