findFirst<T extends LogSpan> method

T? findFirst<T extends LogSpan>()

Finds the first descendant (including self) of type T.

Returns null if no span of type T is found.

Implementation

T? findFirst<T extends LogSpan>() {
  if (this is T) return this as T;
  for (final child in allChildren) {
    final found = child.findFirst<T>();
    if (found != null) return found;
  }
  return null;
}