# extractKeyType method

1. @override

Type? extractKeyType(

1. Class parentClass

)
override

Extract key type for maps

Parameters:

- `parentClass`: The class representing the map.

Returns:

- The key type, or `null` if not a map.

## Example

    final mapClass = await loader.loadClass<Map<String, int>>('dart:core/map.dart.Map');
    final keyType = loader.extractKeyType(mapClass);
    print(keyType?.qualifiedName); // "dart:core/string.dart.String"

## Implementation

    @override
    Type? extractKeyType(Class parentClass) {
      // Handle generic classes with type arguments (Map<K,V> pattern)
      final typeArgs = parentClass.getTypeDeclaration().getTypeArguments();
      if (typeArgs.length >= 2) {
        return _getFromLink(typeArgs[0], parentClass.getProtectionDomain()).getType();
      }

      return null;
    }