firstWhere method

Returns the first element that satisfies the given predicate [test].

E firstWhere(
bool test(E element),
{E orElse()}
)

Returns the first element that satisfies the given predicate [test].

Iterates through elements and returns the first to satsify [test].

If no element satisfies [test], the result of invoking the [orElse] function is returned. If [orElse] is omitted, it defaults to throwing a [StateError].