factory<T extends Object> method

void factory<T extends Object>(
  1. FactoryFunc<T> factoryfunc, {
  2. String? instanceName,
  3. Set<String> registerFor = const {},
})

a conditional wrapper method for getIt.registerFactory it only registers if _canRegister returns true

Implementation

void factory<T extends Object>(
  FactoryFunc<T> factoryfunc, {
  String? instanceName,
  Set<String> registerFor = const {},
}) {
  if (_canRegister(registerFor)) {
    getIt.registerFactory<T>(factoryfunc, instanceName: instanceName);
  }
}