componentType<C> abstract method

Class<C>? componentType<C>()
inherited

Retrieves the element or value type (C) of a collection-like or container-like generic structure.

Supported Generic Types

  • Lists: List<T> → returns Class<T>
  • Sets: Set<T> → returns Class<T>
  • Maps: Map<K, V> → returns Class<V>
  • Queues, Streams, or any class with a single generic parameter.

Example

final listClass = Class.forType<List<double>>();
final componentType = listClass.asGenericSource().componentType<double>();
print(componentType.getName()); // 'double'

Implementation

Class<C>? componentType<C>();