superClassTypeArgs property

List<DartType> superClassTypeArgs

The arguments passed to a super class definition. For example, a field final Currency amount with a type definition class Currency extends OfflineFirstSerdes<T, X, Y> {} would return [T, X, Y].

Implementation

List<DartType> get superClassTypeArgs {
  final classElement = targetType.element2 as ClassElement;
  if (classElement.supertype?.typeArguments == null ||
      classElement.supertype!.typeArguments.isEmpty) {
    throw InvalidGenerationSourceError(
      'Type argument for ${targetType.getDisplayString(withNullability: true)} is undefined.',
      todo:
          'Define the type on class ${targetType.element2}, e.g. `extends ${classElement.supertype!.getDisplayString(withNullability: false)}<int>`',
      element: targetType.element2,
    );
  }

  return classElement.supertype!.typeArguments;
}