findSuperClass abstract method
Finds the superclass of a given parentClass
.
Parameters:
parentClass
: The class whose superclass should be located.declared
: Iftrue
(default), returns the directly declared superclass only.
Iffalse
, returns the nearest superclass in the hierarchy.
Returns:
- The superclass Class instance, or
null
if none exists.
Example
final dogClass = await loader.loadClass<Dog>('com.example.Dog');
final superClass = loader.findSuperClass(dogClass);
print(superClass?.qualifiedName); // e.g., "com.example.Animal"
Usage Notes
- Declared mode is useful for analyzing direct inheritance.
- Non-declared mode is helpful for traversing extended hierarchies.
Implementation
Class? findSuperClass(Class parentClass, [bool declared = true]);