Created
May 9, 2021 22:59
-
-
Save venkatd/88c5c949b6ac8c2d0812e15ce10e40ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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