StructuredFieldItem.fromQueryFilterFields constructor

StructuredFieldItem.fromQueryFilterFields({
  1. required DJson json,
  2. required List<Field> andOrStructure,
  3. required List<Field> valueStructure,
})

Implementation

factory StructuredFieldItem.fromQueryFilterFields({
  required DJson json,
  required List<Field> andOrStructure,
  required List<Field> valueStructure,
}) {
  final List<DynamicFieldItem> items = [];
  final Json effectiveJson = castToJson(json);
  if (_isConditionFieldData(effectiveJson)) {
    for (final Field field in andOrStructure) {
      items.add(DynamicFieldItem.fromField(field, value: effectiveJson[field.id]));
    }
  } else {
    for (final Field field in valueStructure) {
      items.add(DynamicFieldItem.fromField(field, value: effectiveJson[field.id]));
    }
  }
  return StructuredFieldItem(items: items);
}