fromJsonConstructor property

ConstructorElement? fromJsonConstructor

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

Implementation

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

  return null;
}