fromFunctionType function

FunctionType fromFunctionType(
  1. FunctionType functionType
)

Creates an AST for code generation from functionType

Implementation

o.FunctionType fromFunctionType(FunctionType functionType) {
  final returnType = fromDartType(functionType.returnType);
  final paramTypes = <o.OutputType>[];
  for (var parameter in functionType.parameters) {
    paramTypes.add(fromDartType(parameter.type)!);
  }
  var outputType = o.FunctionType(returnType, paramTypes);
  if (functionType.nullabilitySuffix == NullabilitySuffix.question) {
    outputType = outputType.asNullable();
  }
  return outputType;
}