factory<T extends Object> method

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

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,
}) {
  if (_canRegister(registerFor)) {
    getIt.registerFactory<T>(
      factoryFunc,
      instanceName: instanceName,
    );
  }
}