Component class
Annotates an abstract class used as a blueprint to generate an Component.
Example: import 'coffee_shop.inject.dart';
@Component(const [DripCoffeeModule])
abstract class CoffeeShop {
static final create = CoffeeShop$Component.create;
CoffeeMaker get coffeeMaker;
}
main() async {
var coffeeShop = await CoffeeShop.create(new DripCoffeeModule());
print(coffeeShop.coffeeMaker.brewCoffee());
}
In the example, we define an component class CoffeeShop
, which provides a
CoffeeMaker
. It uses DripCoffeeModule
as a source of dependency
providers for the component.
The framework generates a concrete class CoffeeShop$Component
that has a
static asynchronous function named create
, which takes DripCoffeeModule
as an argument and returns a Future<CoffeeShop>
.
CoffeeShop
defines static final create
as a convenience accessor to
CoffeeShop$Component.create
. This is not strictly necessary, but useful to
hide the generated code from the call sites.
Properties
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