isDescendant method

bool isDescendant(
  1. String id,
  2. String ancestorId
)

Returns true if id is ancestorId or one of its descendants.

Implementation

bool isDescendant(String id, String ancestorId) {
  var current = id as String?;
  while (current != null) {
    if (current == ancestorId) return true;
    current = _parents[current];
  }
  return false;
}