withConfig<T> method
- @nonVirtual
- ConfigBuilder<
T, TConfig> builder, { - bool singleton = true,
Registers a singleton builder for an object that requires configuration values
Implementation
@nonVirtual
Factory<T> withConfig<T>(
ConfigBuilder<T, TConfig> builder, {
bool singleton = true,
}) {
final config = injector.get<TConfig>();
return singleton
? Factory.singleton(() => builder(config))
: Factory.provider(() => builder(config));
}