toCopyWith method

String toCopyWith(
  1. String className
)

Implementation

String toCopyWith(String className) {
  final constructorDeclarations = toConstructorDeclarations();
  final bodyDeclarations = where((e) => e.name != null)
      .map(
        (e) => e.copyWithBodyDeclaration(),
      )
      .join(',\n')
      .trim()
      .indented();

  return '$className copyWith({\n'
          '$constructorDeclarations\n'
          '}) => $className(\n'
          '$bodyDeclarations,\n'
          ');'
      .indented();
}