I am trying to add the onElse function to the itterator.firstWhere method, but I cannot get the syntax correctly.
I tried something like
List<String> myList =
String result = myList.firstWhere((o) => o.startsWith('foo'), (o) => null);
But the compiler has an error
Expected 1 positional arguments, but 2 found
I'm sure this is a simple syntax problem, but it puzzled me
source
share