getTypeParameters abstract method

List<Class> getTypeParameters()
inherited

Returns all declared type parameters of this class in the order they appear in the class declaration.

Example

class Pair<K, V> {}
final clazz = Class.forType<Pair>();
final params = clazz.getTypeParameters();

print(params.map((p) => p.getName())); // ['K', 'V']

Returns

  • A list of Class objects representing each generic parameter.
  • Returns an empty list for non-generic types.

Implementation

List<Class> getTypeParameters();