listContainsType<T> function
Returns true
if list
contains elements of type T
.
Implementation
bool listContainsType<T>(Iterable? list) {
if (list == null) return false;
if (list is List<T>) return true;
if (list.isEmpty) return false;
var found = list.firstWhere((l) => l is T, orElse: () => null);
return found != null;
}