# extractComponentType method

1. @override

Type? extractComponentType(

1. Class parentClass

)
override

Extract component type for arrays/lists

Parameters:

- `parentClass`: The class representing the collection.

Returns:

- The component type, or `null` if not an array/list.

## Example

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

## Implementation

    @override
    Type? extractComponentType(Class parentClass) {
      // Handle generic classes with type arguments
      final typeArgs = parentClass.getTypeDeclaration().getTypeArguments();
      if (typeArgs.isNotEmpty && typeArgs.length == 1) {
        return _getFromLink(typeArgs.first, parentClass.getProtectionDomain()).getType();
      } else if (typeArgs.length >= 2) {
        return _getFromLink(typeArgs[1], parentClass.getProtectionDomain()).getType();
      }

      return null;
    }