checkParamHasBothGetterAndSetter static method
Checks if a param has both a getter and setter in the class.
Implementation
static bool checkParamHasBothGetterAndSetter(ParameterElement element, ClassElement aClass) {
if (!element.name.startsWith('_')) {
return true;
}
final publicName = element.name.substring(1);
bool hasGetter = false;
bool hasSetter = false;
for (final accessor in aClass.accessors) {
if (accessor.isSynthetic) continue;
final accessorName =
accessor.displayName.replaceAll('=', '');
if (accessorName != publicName) continue;
if (accessor.isGetter) {
hasGetter = true;
}
if (accessor.isSetter) {
hasSetter = true;
}
}
return hasGetter && hasSetter;
}