fromJsonConstructor function

ConstructorElement? fromJsonConstructor(
  1. ClassElement cls
)

Implementation

ConstructorElement? fromJsonConstructor(ClassElement cls) {
  for (final c in cls.constructors) {
    if (c.name != 'fromJson') continue;
    if (c.parameters.length != 1) continue;
    final t = c.parameters.first.type;
    if (t is InterfaceType && t.isDartCoreMap) return c;
  }
  return null;
}