toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  return {
    'subclass': runtimeType.toString(),
    if (evaluatedField.isNotEmpty) 'evaluatedField': evaluatedField,
    'compare': Compare.values.indexOf(compare),
    if (conditions != null) 'conditions': conditions!.map((s) => s.toJson()).toList(),
    'required': isRequired,
    if (value != null) 'value': value,
  };
}