firstWhereOrNull method
firstWhereOrNull
Tries to find an element E
using the given condition
else it will return null.
Usage:
List<String> items = ["Hello", "World"];
String? word = items.firstWhereOrNull((String element) => element == "Hello")
Implementation
E? firstWhereOrNull(bool Function(E) test) {
for (final E element in this) {
if (test(element)) return element;
}
return null;
}