createClass static method
String
createClass(
{ - required String name,
- String typeClass = 'class',
- String inherit = '',
- List<String> fields = const [],
- List<String> constructorArgs = const [],
- String constructorCode = '',
- bool isConstConstructor = false,
- String code = '',
- bool private = true,
- bool isGenerated = true,
})
Implementation
static String createClass({
required String name,
String typeClass = 'class',
String inherit = '',
List<String> fields = const [],
List<String> constructorArgs = const [],
String constructorCode = '',
bool isConstConstructor = false,
String code = '',
bool private = true,
bool isGenerated = true,
}) {
final className = '${getSymbols(private, isGenerated)}$name';
return """
$typeClass $className $inherit {
${join(iter: fields)}
${isConstConstructor ? 'const' : ''} $className({${join(iter: constructorArgs, char: ',')}})
${isConstConstructor ? ';' : '{$constructorCode}'}
$code
}""";
}