isListOfType<T> function
Returns true
if list
elements are all of type T
.
Implementation
bool isListOfType<T>(Iterable? list) {
if (list == null) return false;
if (list is List<T>) return true;
if (list.isEmpty) return false;
if (listNotMatchesAll(list, (e) => (e is T))) return false;
return true;
}