findComponentType<C> abstract method

Class<C>? findComponentType<C>(
  1. Class parentClass,
  2. Type? component
)

Finds the component type of a collection-like class.

Type Parameters:

  • C: The expected component type.

Parameters:

  • parentClass: The class representing the collection.
  • component: The runtime Type to help narrow the match (optional).

Returns:

  • A Class<C> representing the component type, or null if none exists.

Example

final listClass = await loader.loadClass<List<String>>('dart:core/list.dart.List');
final stringType = loader.findComponentType<String>(listClass);
print(stringType?.qualifiedName); // "dart:core/string.dart.String"

Implementation

Class<C>? findComponentType<C>(Class parentClass, Type? component);