findSuperClassAs<S> abstract method
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
: Iftrue
(default), returns the directly declared superclass.
Iffalse
, 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]);