title: dart How to get an enum with index?
body: <p>I defined an enum: </p>
  
  <pre><code>enum TestEnum {
    test1,
    test2,
  }
  </code></pre>
  
  <p>and I want make an enum with index:</p>
  
  <pre><code>E buildEnum&lt;E extends ?????????????????&gt;(int index) {
    try {
      return E.values[index];
    }
    catch(e) {
      return null;
    }
  }
  </code></pre>
  
  <p>I don't know the type of enum.</p>