Generics: Restricting the parameterized type
class Foo<T extends SomeBaseClass> {
// Implementation goes here...
String toString() => "Instance of 'Foo<$T>'";
}
class Extender extends SomeBaseClass {...}
When implementing a generic type, you might want to limit the types of its parameters. You can do this using extends.