despawn method

void despawn(
  1. Node node
)

Returns node back to the idle pool, removing it from its parent.

If the idle pool has reached maxSize, excess nodes are dropped for garbage collection.

Implementation

void despawn(Node node) {
  if (!_active.remove(node)) return;

  final parent = node.parent;
  if (parent != null) {
    parent.remove(node);
  }

  if (_idle.length < maxSize) {
    _idle.add(node);
  }
}