toJson method

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  Map<String, dynamic> jsonObject = {};
  if (rule == SubmissionRequirementRule.pick) {
    jsonObject['rule'] = 'pick';
  } else {
    jsonObject['rule'] = 'all';
  }
  if (from != null) jsonObject['from'] = from;
  if (fromNested != null) {
    List tmp = [];
    for (var n in fromNested!) {
      tmp.add(n.toJson());
    }
    jsonObject['from_nested'] = tmp;
  }

  if (name != null) jsonObject['name'] = name;
  if (purpose != null) jsonObject['purpose'] = purpose;
  if (min != null) jsonObject['min'] = min;
  if (count != null) jsonObject['count'] = count;
  if (max != null) jsonObject['max'] = max;
  return jsonObject;
}