Dart mewarisi dari generik

// 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);
}
Naughty Nightingale