Skip to content

Instantly share code, notes, and snippets.

@venkatd
Created May 9, 2021 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venkatd/88c5c949b6ac8c2d0812e15ce10e40ce to your computer and use it in GitHub Desktop.
Save venkatd/88c5c949b6ac8c2d0812e15ce10e40ce to your computer and use it in GitHub Desktop.
void main() {
final lst1 = ["t1" , "t2" , "t3" , "t4"];
final lst2 = ["t2" , "t4" , "t5"];
final diff = lst1.whereNotIn(lst2).toList();
print(diff);
}
extension WhereNotInExt<T> on Iterable<T> {
Iterable<T> whereNotIn(Iterable<T> reject) {
final rejectSet = reject.toSet();
return where((el) => !rejectSet.contains(el));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment