SHARE
TWEET

Untitled

a guest Jun 20th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void main() {
  2.   List<dynamic> box1 = [{'id': 1, 'name': 'john'}, {'id': 2, 'name': 'eric'}] ;
  3.   List<dynamic> box2 = [{'id': 1, 'name': 'eric'}, {'id': 2, 'name': 'alex'}, {'id': 3, 'name': 'john'}];
  4.  
  5.   var commons = List();
  6.  
  7.   box1.forEach((b1) {
  8.     box2.forEach((b2) {
  9.       if(b1['name'] == b2['name'] && !commons.contains(b2['name'])) commons.add(b2);
  10.     });
  11.   });
  12.  
  13.   print(commons);
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top