hasLiveChildren method

bool hasLiveChildren(
  1. TKey parent
)

Whether parent has at least one live (non-pending-deletion) child.

Non-allocating variant of getLiveChildren(parent).isNotEmpty for per-pointer-move hot paths: drop-zone resolution asks this on every pointer move and autoscroll tick, and the list-materializing form copied the full child list just to test emptiness. O(1) when no deletions are pending; otherwise O(children until the first live hit).

Implementation

bool hasLiveChildren(TKey parent) {
  final full = _childListOf(parent);
  if (full == null || full.isEmpty) {
    return false;
  }
  if (_anim.pendingDeletionCount == 0) {
    return true;
  }
  for (final k in full) {
    if (!_isPendingDeletion(k)) {
      return true;
    }
  }
  return false;
}