I have Two List.
List<String> A=['1','2','3','4','5'];
List<String> B=['4','5','6','7'];
How to create common element list ?
output
List<String> C=['4','5'];
>Solution :
using .toSet()
List<String> a=['1','2','3','4','5'];
List<String> b=['4','5','6','7'];
List<int> c = a.toSet().where((element) => b.toSet().contains(element)).toList();