CombinedCondition.deserialize constructor

CombinedCondition.deserialize(
  1. Map<String, String> jsonMap
)

Factory constructor to parse a CombinedCondition instance from the given JSON map.

Implementation

factory CombinedCondition.deserialize(Map<String, String> jsonMap) {
  if (jsonMap['conditionName'] != 'CombinedCondition') {
    throw SerializationException('Error occurred during deserializing the CombinedCondition JSON string: $jsonMap');
  }
  if (jsonMap['conditions'] == null) {
    return const CombinedCondition(<SerializableWaitCondition>[]);
  }

  final List<SerializableWaitCondition> conditions = <SerializableWaitCondition>[];
  for (final Map<String, dynamic> condition in (json.decode(jsonMap['conditions']!) as List<dynamic>).cast<Map<String, dynamic>>()) {
    conditions.add(_deserialize(condition.cast<String, String>()));
  }
  return CombinedCondition(conditions);
}