StructuredFieldItem.fromValues constructor

StructuredFieldItem.fromValues(
  1. dynamic json,
  2. List<Field> fields
)

Implementation

factory StructuredFieldItem.fromValues(dynamic json, List<Field> fields) {
  if (json == null || json is! DJson) {
    return StructuredFieldItem(items: fields.map((Field field) => DynamicFieldItem.fromField(field)).toList());
  }
  final List<DynamicFieldItem> items = [];
  final Json effectiveJson = castToJson(json);
  for (final Field field in fields) {
    items.add(DynamicFieldItem.fromField(field, value: effectiveJson[field.id]));
  }
  return StructuredFieldItem(items: items);
}