Is this the correct way to declare a "generic class" that extends another "generic class" in dart? Note that the generic parameter has a type restriction.
// available types
class BaseType {}
class DerivedType extends BaseType {}
class BaseClass<Type extends BaseType> {
final Type prop;
BaseClass(this.prop) {
// can be either BaseType or DerivedType
print(prop);
}
}
class DerivedClass<Type extends BaseType> extends BaseClass<BaseType> {
DerivedClass(BaseType prop) : super(prop);
}
The above code works, but I'm not sure if I am using the correct syntax.