getHashCodeMethod function
MethodDeclaration?
getHashCodeMethod(
- ClassDeclaration node
Gets the hashCode method from a class, if it exists
Implementation
MethodDeclaration? getHashCodeMethod(ClassDeclaration node) {
try {
return node.members.whereType<MethodDeclaration>().firstWhere((member) {
final name = member.declaredFragment?.element.name ?? member.name.lexeme;
return name == 'hashCode' && member.isGetter;
});
} catch (_) {
return null;
}
}