removeMapping<T> method

Injector removeMapping<T>({
  1. String? key,
})

Removes the type mapping from the injector if present. Optionally give it a named key. The remove operation is silent, means no exception is thrown if the type or key combination is not present.

Returns the current injector instance.

Implementation

Injector removeMapping<T>({
  String? key,
}) {
  final objectKey = _makeKey(T, key);
  if (_factories.containsKey(objectKey)) {
    _factories.remove(objectKey);
  }

  return this;
}