how to check if two lists have the same elements dart code example
Example: dart compare two lists
if (list1.any((item) => list2.contains(item))) {
// Lists have at least one common element
} else {
// Lists DON'T have any common element
}
if (list1.any((item) => list2.contains(item))) {
// Lists have at least one common element
} else {
// Lists DON'T have any common element
}