getMissingFieldsInToString function
Set<String>
getMissingFieldsInToString(
- ClassDeclaration classDecl,
- MethodDeclaration toStringMethod
Returns the set of fields that are missing from an existing toString method
Implementation
Set<String> getMissingFieldsInToString(
ClassDeclaration classDecl,
MethodDeclaration toStringMethod,
) {
final classFieldNames = getClassFields(classDecl).map((field) => field.name);
final toStringFieldNames = getFieldsInFunctionBody(toStringMethod);
return classFieldNames
.where((field) => !toStringFieldNames.contains(field))
.toSet();
}