title: What is the difference between listen and forEach in Dart streams?
body: <p>If I have <code>Stream</code> in Dart, I can use both <code>listen</code> and <code>forEach</code>, but I don't understand the difference.</p>
  
  <p>So for example consider this code:</p>
  
  <pre><code>final process = await Process.start('pub', ['serve']);
  process.stdout.map((l) =&gt; UTF8.decode(l)).forEach(print);
  </code></pre>
  
  <p>I could also have written:</p>
  
  <pre><code>process.stdout.map((l) =&gt; UTF8.decode(l)).listen(print);
  </code></pre>
  
  <p>Is there any difference?</p>