findSuperClassAs<S> abstract method

Class<S>? findSuperClassAs<S>(
  1. Class parentClass, [
  2. bool declared = true
])

Finds and casts the superclass of a given parentClass to a specific type.

Type Parameters:

  • S: The expected type of the superclass.

Parameters:

  • parentClass: The class whose superclass should be located.
  • declared: If true (default), returns the directly declared superclass.
    If false, searches up the hierarchy.

Returns:

  • A typed Class<S> instance if found, or null otherwise.

Example

final listClass = await loader.loadClass<List>('dart:core/list.dart.List');
final superIterable = loader.findSuperClassAs<Iterable>(listClass);
print(superIterable?.qualifiedName); // e.g., "dart:core/iterable.dart.Iterable"

Implementation

Class<S>? findSuperClassAs<S>(Class parentClass, [bool declared = true]);