bind<T> method Null safety

void bind<T>(
  1. {required String namespace,
  2. required T service}
)

Registers a new service within the IOC. class MyService {}

ioc.bind(namespace: 'Mineral/Services/MyService', MyService);

Implementation

void bind<T> ({ required String namespace, required T service }) {
  if (_services.containsKey(namespace)) {
    throw ServiceAlreadyRegistered();
  }

  _services.putIfAbsent(namespace, () => service);
}