%S or %C for Strings
fun main(args: Array<String>) {
val mainClass = ClassSpec.builder("HelloWord")
.function(getFunction("%S", "Dart")) // Uses double quotes
.function(getFunction("%C", "Poet")) // Uses single quotes
.build()
val dartFile = DartFile.builder("hello_world")
.type(mainClass)
.build()
dartFile.write(System.out) // Writes the code into the output stream
}
class HelloWord {
String getDart() {
return "Dart";
}
String getPoet() {
return 'Poet';
}
}Last updated