title: Non-mutating sorted list in Dart
body: <p>I can sort a list like this in Dart:</p>
  <pre class="lang-dart prettyprint-override"><code>final myList = [6, 3, 7, 1, 0, 2];
  myList.sort();
  </code></pre>
  <p>However, this is a destructive sort since it mutates it in place. I'd like to do something like this:</p>
  <pre class="lang-dart prettyprint-override"><code>final myList = [6, 3, 7, 1, 0, 2];
  final newList = myList.sorted();
  </code></pre>
  <p>where my list stays the same but <code>newList</code> contains the sorted list. Dart apparently doesn't have this functionality, so how do I implement that myself?</p>
  <p>In searching for the answer to this question my main struggle was knowing the proper way to copy a list, which wasn't as obvious as it seems like it should be. <a href="https://suragch.medium.com/cloning-lists-maps-and-sets-in-dart-d0fc3d6a570a" rel="nofollow noreferrer">I found the answer to that</a>, so I am also posting an answer to my original question below, Q&amp;A style.</p>