instantiate modules if they have a default constructor
ralph-bergmann opened this issue · 0 comments
ralph-bergmann commented
Currently, the create
method expects objects from all modules, even if they have a default constructor.
If a module has a default constructor, generate code to instantiate it, so the user does not have to.
old:
final coffee = await Coffee.create(DripCoffeeModule());
static _i5.Future<_i1.Coffee> create(
_i2.DripCoffeeModule dripCoffeeModule) async {
// ...
}
new:
final coffee = await Coffee.create();
static _i5.Future<_i1.Coffee> create(
{_i2.DripCoffeeModule dripCoffeeModule = _i2.DripCoffeeModule()}) async {
// ...
}