title: How to create a generic method in Dart?
body: <p>I'm trying to use generic methods in Dart (1.22.0-dev.10.3).  Here is a simple example:</p>
  
  <pre><code>abstract class VR&lt;T&gt; {
    VR();
  
    bool foo&lt;T&gt;(T value);
  }
  
  class VRInt extends VR&lt;int&gt; {
    VRInt();
  
    bool foo&lt;int&gt;(int n) =&gt; n &gt; 0; // Thinks n is Object
  }
  
  class VRString extends VR&lt;String&gt; {
    VRString();
  
    bool foo&lt;String&gt;(String s) =&gt; s.length &gt; 0; // Thinks s is Object
  }
  </code></pre>
  
  <p>Both subclasses generate errors that say the argument to <code>foo</code> is an Object.</p>
  
  <p>I'm sure this is just a syntactic error on my part, but I've searched the documentation and can't find an answer.</p>