Generics 泛型类中的多约束

Generics 泛型类中的多约束,generics,flutter,dart,Generics,Flutter,Dart,如何在dart lang的泛型类中执行多个约束 class ClassA<T implements ClassB<T> & ClassC<T>> { } A类{ } 比如C代码 class EmployeeList,其中T:Employee,ieemployee,System.IComparable,new() { // ... } 这是不可能的 最好的方法是创建一个同时实现两个接口的抽象类,并将其用作约束 class EmployeeList&

如何在dart lang的泛型类中执行多个约束

class ClassA<T implements ClassB<T> & ClassC<T>>  {
}
A类{
}
比如C代码

class EmployeeList,其中T:Employee,ieemployee,System.IComparable,new()
{
// ...
}
这是不可能的

最好的方法是创建一个同时实现两个接口的抽象类,并将其用作约束

class EmployeeList<T> where T : Employee, IEmployee, System.IComparable<T>, new()
{
    // ...
}