Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple constraints in generic class

How can I perform Multiple Constraints in Generic class in dart lang

class ClassA<T implements ClassB<T> & ClassC<T>>  {
}

Like C# Code

class EmployeeList<T> where T : Employee, IEmployee, System.IComparable<T>, new()
{
    // ...
}
like image 529
hossameldinmi Avatar asked Sep 19 '25 19:09

hossameldinmi


1 Answers

That is not possible.

The best thing you can have is to make an abstract class that implement both interfaces at once, and use that as constraints instead.

like image 195
Rémi Rousselet Avatar answered Sep 21 '25 10:09

Rémi Rousselet