title: Modify object from multiple async streams in Dart
body: <p>Imagine we had a object like this </p>
  
  <pre><code>class Foo {
    List&lt;int&gt; data = [];
  
    void addAndCheck(int n){
      for(int number in data){
          // check something
      }
      data.add(n);
    }
  }
  </code></pre>
  
  <p>and the imagine we spawn a bunch of subscriptions like this</p>
  
  <pre><code>Foo foo = Foo();
  
  for(int i = 0; i++; i&lt;10){
    subscriptions.add(api.someRandomStream().listen((response){
      foo.addAndCheck(response.value);
    }));
  }
  </code></pre>
  
  <p>As it stands, if this code is run it might work but as soon as the streams start emitting around the same time we get a exception: <code>Concurrent modification during iteration</code></p>
  
  <p>The cause is the for loop, but how can this problem be solved? In a language like Java there are things like ConcurrentHashMap, Collections.synchronizedList(...), etc.. </p>