Module class

Encapsulates a reusable set of dependency injection configurations.

One or more modules can be used to create an Injector, or a runtime representation of dependency injection. Modules can also be used to add dependency injection to @Directive or @Component-annotated classes.

Other modules are included (include) before providers (provide).

Previously, AngularDart loosely expressed "modules" as a recursive list of both providers and other lists of providers. For example, the following pattern may be re-written to use Module:

// Before.
const carModule = [
  ClassProvider(Car, useClass: AmericanCar),
];

const autoShopModule = [
  carModule,
  ClassProvider(Oil, useClass: GenericOil),
];

// After.
const carModule = Module(
  provide: [
    ClassProvider(Car, useClass: AmericanCar),
  ],
);

const autoShopModule = Module(
  include: [
    carModule,
  ],
  provide: [
    ClassProvider(Oil, useClass: GenericOil),
  ],
);

Constructors

Module({List<Module> include, List<Provider<Object>> provide})
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
include List<Module>
final
provide List<Provider<Object>>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited