dart generics and inheritance code example
Example: dart inherit from generic
// 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);
}