remove<T extends ScopedDisposableObjectMixin> method

T? remove<T extends ScopedDisposableObjectMixin>(
  1. ScopedKey key
)

Remove the ScopedDisposableObjectMixin object by key

Implementation

T? remove<T extends ScopedDisposableObjectMixin>(ScopedKey key) {
  T? returnValue;
  final thePool = pool;
  if (_isClearing) {
    for (final k in thePool.keys) {
      if (k == key) {
        thePool[key] = null;
        returnValue = null;
      }
    }
  } else {
    returnValue = thePool.remove(key) as T?;
  }

  return returnValue;
}