toJson method

Map<String, Object?> toJson()

Implementation

Map<String, Object?> toJson() {
  final json = <String, Object?>{
    'id': id,
    'type': type,
    'isReference': isReference,
  };

  if (isReference) {
    json['referenceTo'] = referenceTo;
    return json;
  }

  json['hasPreprocess'] = hasPreprocess;
  json['rules'] = rules.map((rule) => rule.toJson()).toList(growable: false);

  return json;
}