Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main() {
- List<dynamic> box1 = [{'id': 1, 'name': 'john'}, {'id': 2, 'name': 'eric'}] ;
- List<dynamic> box2 = [{'id': 1, 'name': 'eric'}, {'id': 2, 'name': 'alex'}, {'id': 3, 'name': 'john'}];
- var commons = List();
- box1.forEach((b1) {
- box2.forEach((b2) {
- if(b1['name'] == b2['name'] && !commons.contains(b2['name'])) commons.add(b2);
- });
- });
- print(commons);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement