hasT<T> function Null safety

bool hasT<T>(
  1. InlineSpan? textSpan
)

Implementation

bool hasT<T>(InlineSpan? textSpan) {
  if (textSpan == null) {
    return false;
  }
  if (textSpan is T) {
    return true;
  }
  if (textSpan is TextSpan && textSpan.children != null) {
    for (final InlineSpan ts in textSpan.children!) {
      final bool has = hasT<T>(ts);
      if (has) {
        return true;
      }
    }
  }
  return false;
}