getCopyWithParameters function

Set<String> getCopyWithParameters(
  1. MethodDeclaration method
)

Gets the parameter names from a copyWith method

Implementation

Set<String> getCopyWithParameters(MethodDeclaration method) {
  final params = <String>{};
  final paramList = method.parameters?.parameters;
  if (paramList != null) {
    for (final param in paramList) {
      if (param is DefaultFormalParameter) {
        params.add(param.name!.lexeme);
      } else if (param is SimpleFormalParameter) {
        params.add(param.name!.lexeme);
      }
    }
  }
  return params;
}