superClassTypeArgs property

List<DartType> get 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.element 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.element}, e.g. `extends ${withoutNullability(classElement.supertype!)}<int>`',
      element: targetType.element,
    );
  }

  return classElement.supertype!.typeArguments;
}