toScript method
Export the DartBlock program to a typed language.
Java
: creates aLauncher
class which will contain the main function of the DartBlock as the main method, as well as the custom functions as static methods of the same class.
Implementation
String toScript({
DartBlockTypedLanguage language = DartBlockTypedLanguage.java,
}) {
switch (language) {
case DartBlockTypedLanguage.java:
return "class Launcher {\n"
"\t${mainFunction.toScript(language: language)}${customFunctions.isNotEmpty ? '\n\n\t' : ''}${customFunctions.map((e) => e.toScript(language: language)).join("\n\n\t")}"
"\n}";
}
}