removeAllKeyed method

ServiceCollection removeAllKeyed(
  1. Type serviceType,
  2. Object? serviceKey
)

Removes all services of type serviceType in ServiceCollection.

Implementation

ServiceCollection removeAllKeyed(Type serviceType, Object? serviceKey) {
  for (var i = length - 1; i >= 0; i--) {
    var descriptor = this[i];
    if (descriptor.serviceType == serviceType &&
        descriptor.serviceKey == serviceKey) {
      removeAt(i);
    }
  }
  return this;
}