Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: product "getAttribute" method #799

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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