toJson method

Map<String, Object> toJson()

Converts a FlowSchemaSpec instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempDistinguisherMethod = distinguisherMethod;
  final tempMatchingPrecedence = matchingPrecedence;
  final tempPriorityLevelConfiguration = priorityLevelConfiguration;
  final tempRules = rules;

  if (tempDistinguisherMethod != null) {
    jsonData['distinguisherMethod'] = tempDistinguisherMethod.toJson();
  }

  if (tempMatchingPrecedence != null) {
    jsonData['matchingPrecedence'] = tempMatchingPrecedence;
  }

  jsonData['priorityLevelConfiguration'] =
      tempPriorityLevelConfiguration.toJson();

  if (tempRules != null) {
    jsonData['rules'] =
        tempRules.map((e) => e.toJson()).toList(growable: false);
  }

  return jsonData;
}