title: How to show list of only the completed items?
body: <p>I have a button and every time I press it should either show me the completed or uncompleted.</p>
  
  <p>I tried to think of how everything should work. But can't figure out how to sort them properly, loop through all or loop through all completed.</p>
  
  <pre class="lang-dart prettyprint-override"><code>tasks.forEach((task) {
        if (task.completed) {
          list.removeAt(task);
        } else {
          list.insert(tasks.indexOf(task), task);
        }
      });
  </code></pre>
  
  <p>The first press should show the completed only and next press only the uncompleted and it keeps going on like that.</p>