toJsonMethod property

MethodElement? get toJsonMethod

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

Implementation

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

  return null;
}