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