injectable
injectable copied to clipboard
[Feature] Concurrency for async registrations
It would be nice if the package knew to generate async registrations in concurrent fashion.
For example: A service and B service are async singletons and they don't depend on any other service. With the current version the package will generate this code (preResolve is true).
await gh.singletonAsync<_i11.A>(
() => A.create(),
preResolve: true,
);
await gh.singletonAsync<_i12.B>(
() => B.create(),
preResolve: true,
);
If concurrency will be implemented the code will become like so:
await Future.wait([
gh.singletonAsync<_i11.A>(
() => A.create(),
preResolve: true,
),
gh.singletonAsync<_i12.B>(
() => B.create(),
preResolve: true,
)
]);
Why we need this feature? This will make the app start up faster! Now my app starts in about 1 second, which I think can be improved drastically if the GetIt setup was using concurrency.
Thanks.