title: How can an ObservableList<T> be sorted in Dart?
body: <p>I can't seem to sort an <code>ObservableList&lt;T&gt;</code> and have the sort reflected in my Polymer element. Here's a sample element definition:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class PeopleElement extends PolymerElement {
    ObservableList&lt;Person&gt; people = toObservable(new List&lt;Person&gt;());
  
    PeopleElement.created() : super.created();
  }
  </code></pre>
  
  <p>And here is the definition of the <code>Person</code> class:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class Person {
    String name;
    Person(this.name);
  
    int compare(Person p) {
      return name.compareTo(p.name);
    }
  }
  </code></pre>
  
  <p>Now, I want to add a <code>sort</code> function to the <code>PeopleElement</code> class:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class PeopleElement extends PolymerElement {
    ...
  
    ObservableList&lt;Person&gt; sortByName() {
      people.sort((Person a, Person b) {
        a.compare(b);
      }
    }
  }
  </code></pre>
  
  <p>I've also tried the above function as returning <code>void</code> and that didn't seem to work either. Does anything jump out as being incorrect here?</p>