factoryMethod method
Implementation
String factoryMethod(String resultType, String tyArgs, String constructor) {
String mkFun(String arg, String result) {
return '''static $resultType $name$tyArgs($arg) =>
$constructor($name: $result);''';
}
if (this.type.isUnit) {
return mkFun('', 'const ${type.typeRepr}()');
} else {
const x = r'__x$';
return mkFun('${type.typeRepr} $x', x);
}
}