toJsonMethod property

MethodElement? toJsonMethod

Retrieves the toJson method element. If the method can't be found, null is returned.

Implementation

MethodElement? get toJsonMethod {
  if (targetType.element2 is ClassElement) {
    for (final method in (targetType.element2 as ClassElement).methods) {
      if (method.name == 'toJson') return method;
    }
  }

  return null;
}