graphQLToDartType function
Implementation
String graphQLToDartType(
GraphQLType<Object?, Object?> type, {
bool nullable = true,
}) {
final n = nullable && type is! GraphQLNonNullType ? '?' : '';
if (type is GraphQLListType) {
return 'List<${graphQLToDartType(type.ofType)}>$n';
} else if (type is GraphQLNonNullType) {
return graphQLToDartType(type.ofType, nullable: false);
} else if (primitiveGraphQLToDart.containsKey(type.name)) {
return '${primitiveGraphQLToDart[type.name]}$n';
} else {
return '${type.name}$n';
}
}