Skip to content

Commit

Permalink
feat: product "getAttribute" method (#799)
Browse files Browse the repository at this point in the history
Impacted file:
* `product.dart`: new `getAttribute` method
  • Loading branch information
monsieurtanuki committed Sep 7, 2023
1 parent 3cf14f2 commit a179dc5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/src/model/product.dart
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ class Product extends JsonObject {
return json;
}

/// Returns all existing product attributes matching a list of attribute ids
/// Returns all existing product attributes matching a list of attribute ids.
Map<String, Attribute> getAttributes(
final List<String> attributeIds,
) {
Expand All @@ -715,6 +715,16 @@ class Product extends JsonObject {
return result;
}

/// Returns the product attribute matching an attribute id.
Attribute? getAttribute(
final String attributeId,
) {
final Map<String, Attribute> attributes = getAttributes(
<String>[attributeId],
);
return attributes[attributeId];
}

/// Returns all the potential improvements given the quality of the data
///
/// For apps with contribution mode.
Expand Down

0 comments on commit a179dc5

Please sign in to comment.