getSuperClass<S> abstract method

Class<S>? getSuperClass<S>()

Gets the direct superclass with proper generic typing.

Type Parameters:

  • S: The expected superclass type

Returns:

  • The superclass with resolved generic parameters
  • null if no superclass exists

Example:

class Parent<T> {}
class Child extends Parent<String> {}

final childClass = Class.forType<Child>();
final parentClass = childClass.getSuperClass<Parent>();
print(parentClass?.componentType<String>()); // Class<String>

Implementation

Class<S>? getSuperClass<S>();