FlowSchemaSpec.fromJson constructor

FlowSchemaSpec.fromJson(
  1. Map<String, dynamic> json
)

Creates a FlowSchemaSpec from JSON data.

Implementation

factory FlowSchemaSpec.fromJson(Map<String, dynamic> json) {
  final tempDistinguisherMethodJson = json['distinguisherMethod'];
  final tempMatchingPrecedenceJson = json['matchingPrecedence'];
  final tempPriorityLevelConfigurationJson =
      json['priorityLevelConfiguration'];
  final tempRulesJson = json['rules'];

  final FlowDistinguisherMethod? tempDistinguisherMethod =
      tempDistinguisherMethodJson != null
          ? FlowDistinguisherMethod.fromJson(tempDistinguisherMethodJson)
          : null;
  final int? tempMatchingPrecedence = tempMatchingPrecedenceJson;
  final PriorityLevelConfigurationReference tempPriorityLevelConfiguration =
      PriorityLevelConfigurationReference.fromJson(
          tempPriorityLevelConfigurationJson);

  final List<PolicyRulesWithSubjects>? tempRules = tempRulesJson != null
      ? List<dynamic>.from(tempRulesJson)
          .map(
            (e) => PolicyRulesWithSubjects.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  return FlowSchemaSpec(
    distinguisherMethod: tempDistinguisherMethod,
    matchingPrecedence: tempMatchingPrecedence,
    priorityLevelConfiguration: tempPriorityLevelConfiguration,
    rules: tempRules,
  );
}