hasPropertyAccessor method

  1. @override
bool hasPropertyAccessor(
  1. String name
)
override

Returns true if this element has a property accessor with the given name.

Implementation

@override
bool hasPropertyAccessor(String name) {
  if (_didResolveMethods) {
    return _methods.any((MethodElement e) => e.name == name && e is PropertyAccessorElement);
  }
  for (final MethodDeclaration method in compilationUnit.childEntities.whereType<MethodDeclaration>()) {
    if (method.name.lexeme == name && method.propertyKeyword != null) {
      return true;
    }
  }
  return false;
}