toConstructor method

String toConstructor(
  1. String className, {
  2. required bool hasExtends,
  3. required bool hasMixin,
})

Implementation

String toConstructor(String className, {required bool hasExtends, required bool hasMixin}) {
  final declarations = where((e) => e.name != null).map((e) => e.toConstructor()).join('\n').trim();
  final isConst = (!hasExtends && !hasMixin) ? 'const ' : '';
  return '$isConst$className({\n  $declarations\n});'.indented();
}