firstOfTypeOrNull<T extends AIContent> method

T? firstOfTypeOrNull<T extends AIContent>()

Returns the first item of type T, or null if none exists.

Implementation

T? firstOfTypeOrNull<T extends AIContent>() {
  for (final item in this) {
    if (item is T) return item;
  }
  return null;
}