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

fix: summary card with no category #1107

Merged
merged 2 commits into from
Feb 11, 2022
Merged

fix: summary card with no category #1107

merged 2 commits into from
Feb 11, 2022

Conversation

stephanegigandet
Copy link
Contributor

I think my issue #1106 is due to products without a category, I have errors in the debugger on the call to .last

final String? categoryTag = widget._product.categoriesTags?.last;

This PR seems to solve the problem for me.

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good @stephanegigandet!

My bad with a lazy management of null.

A suggestion for code clarity given the length of the line: you need just one test (twice). And we need both fields to be populated.

String? categoryTag;
String? categoryLabel;
if (widget._product.categoriesTags?.isNotEmpty ?? false) {
  categoryTag = widget._product.categoriesTags!.last;
  if (widget._product.categoriesTagsInLanguages?[ProductQuery.getLanguage()!]?.isNotEmpty ?? false) {
    categoryLabel = widget._product.categoriesTagsInLanguages![ProductQuery.getLanguage()!]!.last; 
  }
}

@stephanegigandet
Copy link
Contributor Author

Thank you @monsieurtanuki , I commited your suggestion.

@teolemon teolemon merged commit f1777e8 into develop Feb 11, 2022
@teolemon teolemon deleted the issue-1106 branch February 11, 2022 18:59
@teolemon
Copy link
Member

thanks @stephanegigandet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants