fromJsonConstructor property

ConstructorElement? get fromJsonConstructor

Retrieves the fromJson factory element. If the constructor can't be found, null is returned.

Implementation

ConstructorElement? get fromJsonConstructor {
  if (targetType.element is ClassElement) {
    for (final constructor in (targetType.element as ClassElement).constructors) {
      if (constructor.name == 'fromJson') return constructor;
    }
  }

  return null;
}