getAttributes method

Map<String, Attribute> getAttributes(
  1. List<String> attributeIds
)

Returns all existing product attributes matching a list of attribute ids

Implementation

Map<String, Attribute> getAttributes(
  final List<String> attributeIds,
) {
  final Map<String, Attribute> result = <String, Attribute>{};
  if (attributeGroups == null) {
    return result;
  }
  for (final AttributeGroup attributeGroup in attributeGroups!) {
    if (attributeGroup.attributes == null) {
      continue;
    }
    for (final Attribute attribute in attributeGroup.attributes!) {
      final String attributeId = attribute.id!;
      if (attributeIds.contains(attributeId)) {
        result[attributeId] = attribute;
      }
    }
  }
  return result;
}