title: Limit a generic type argument only to be a int, double or custom class
body: <p>I trying make the following code but T only can be int, double or a custom class. I couldn't find how to restrict the type in <strong>Dart</strong> or something that work like <strong>where</strong> from <strong>C#</strong>. How can I do that in Dart?</p>
  
  <pre><code>class Array3dG&lt;T&gt; extends ListBase&lt;T&gt; {
    List&lt;T&gt; l = List&lt;T&gt;();
    Array3dG(List&lt;T&gt; list) {
      l = list;
    }
    set length(int newLength) { l.length = newLength; }
    int get length =&gt; l.length;
    T operator [](int index) =&gt; l[index];
    void operator []=(int index, T value) { l[index] = value; }
  }
  </code></pre>