createClass static method

String createClass({
  1. required String name,
  2. String typeClass = 'class',
  3. String inherit = '',
  4. List<String> fields = const [],
  5. List<String> constructorArgs = const [],
  6. String constructorCode = '',
  7. bool isConstConstructor = false,
  8. String code = '',
  9. bool private = true,
  10. 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
}""";
}