add<T> method

void add<T>({
  1. Type? key,
  2. required InitFactory<T> init,
})

Stores init Factory for later use - ControlFactory.init or ControlFactory.get.

Implementation

void add<T>({Type? key, required InitFactory<T> init}) {
  key ??= T;

  assert(() {
    if (_factory.containsKey(key)) {
      printDebug(
          'Factory already contains key: $key. Value of this key will be override.');
    }
    return true;
  }());

  _factory[key] = init;
}