How to search a list of a class object with one of its property matching to any value in another list of strings
I am able to get filtering based on a single string , bu
List list = list to search;
List matchingList = list of strings that you want to match against;
list.where((item) => matchingList.contains(item.relevantProperty));
If the number of items in list
is large, you might want to do:
List list = list to search;
List matchingList = list of strings that you want to match against;
final matchingSet = HashSet.from(matchingList);
list.where((item) => matchingSet.contains(item.relevantProperty));
Or else just always store the matching values as a hashset.