Generics for methods #7099
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-duplicate
Closed in favor of an existing report
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by [email protected]
Not able to find much info in the spec for this. Coming from C# I can do things with generics such as...
class A
{
var _list = new List<B>();
T add<T>(){
if(T is B){
var newT = new T();
_list.add(newT);
return newT;
}
}
}
abstract class B
{
}
class C extends B
{
}
main(){
var a = new A();
var c = a.add<C>();
}
However this doesn't seem supported in Dart; am I missing something?
The text was updated successfully, but these errors were encountered: