computeTypeRepr function Null safety

String computeTypeRepr(
  1. DartType ty,
  2. ImportModel imports
)

Implementation

String computeTypeRepr(DartType ty, ImportModel imports) {
  if (ty is FunctionType) {
    throw CodegenException('function types are not supported');
  } else if (ty.isDynamic) {
    return 'dynamic';
  } else if (ty is ParameterizedType && ty.typeArguments.isNotEmpty) {
    final base = qualifyType(ty, imports);
    final args = ty.typeArguments.map((tyArg) => computeTypeRepr(tyArg, imports));
    return '$base<${args.join(', ')}>';
  } else {
    return qualifyType(ty, imports);
  }
}