Skip to content

Commit

Permalink
feat: product "getAttribute" method
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 a26ec2a commit fcc4d58
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 fcc4d58

Please sign in to comment.