dart - limit T in a generic class to types that implement some interface -


in dart consider following

class question<t>{   string body;   t answer; }  //an interface class ianswer{   string value()=>this.tostring();   } 

i need t limited types example implement interface ianswer, possible without having check if t ianswer , throw , exception in question constructor?

class question<t extends ianswer>{   string body;   t answer; } 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -