get array indexwhere in flutter code example
Example: flutter indexwhere examples
/// Find a person in the list using indexWhere method.
void findPersonUsingIndexWhere(List<Person> people,
String personName) {
// Find the index of person. If not found, index = -1
final index = people.indexWhere((element) =>
element.name == personName);
if (index >= 0) {
print('Using indexWhere: ${people[index]}');
}
}