Check out example codes for "dart compare two lists". It will help you in understanding the concepts better.

Code Example 1

Function eq = const ListEquality().equals;
print(eq([1,'two',3], [1,'two',3])); // => true

Code Example 2

if (list1.any((item) => list2.contains(item))) {
    // Lists have at least one common element
} else {
    // Lists DON'T have any common element
}

Learn ReactJs, React Native from akashmittal.com