Answers for "compare 2 lists and find differece dart"

2

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
}
Posted by: Guest on July-21-2020
0

dart find difference between lists

List<double> first = [1,2,3,4,5,6,7];
List<double> second = [3,5,6,7,9,10];
List<double> output = [];

first.forEach((element) {
    if(!second.contains(element)){
    output.add(element);
}
});

//at this point, output list should have the answer
Posted by: Guest on March-15-2021

Code answers related to "compare 2 lists and find differece dart"

Code answers related to "Dart"

Browse Popular Code Answers by Language