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

Error message when an attribute is not returned by the API (Eco-Score) #131

Closed
stephanegigandet opened this issue Jan 30, 2021 · 0 comments · Fixed by #132
Closed

Error message when an attribute is not returned by the API (Eco-Score) #131

stephanegigandet opened this issue Jan 30, 2021 · 0 comments · Fixed by #132
Assignees

Comments

@stephanegigandet
Copy link
Contributor

The attribute API is subject to change: new attribute groups and attributes will be added, and in some cases, some attributes may be removed (either entirely, or on a product per product basis). So the app should not make any expectation about the returned attribute groups and attributes, and handle them gracefully.

We just disabled the Eco-Score for countries other than France, and as the app is not passing the country in the cc field, the ecoscore attribute is not returned.

It results in an error:

======== Exception caught by widgets library =======================================================
The following NoSuchMethodError was thrown building AttributeCard(dirty):
The getter 'title' was called on null.
Receiver: null
Tried calling: title

When the exception was thrown, this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1 AttributeCard.build (package:smooth_app/cards/data_cards/attribute_card.dart:23:29)
#2 StatelessElement.build (package:flutter/src/widgets/framework.dart:4701:28)
#3 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4627:15)
#4 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)

image

@stephanegigandet stephanegigandet self-assigned this Jan 30, 2021
@stephanegigandet stephanegigandet linked a pull request Jan 30, 2021 that will close this issue
monsieurtanuki referenced this issue in monsieurtanuki/smooth-app Jan 30, 2021
…ipe/dismiss

Impacted files:
* `attribute_list_expandable.dart`: unrelated fix for #131
* `dao_product_list.dart`: added methods `clear` and `paste`
* `list_page.dart`: refactoring
* `product_list_page.dart`: added a Swipe+Dismissible effect on user lists; added a BottomNavigationBar to copy/paste/clear/delete
* `product_page.dart`: made public the `showLists` method
* `smooth_product_card_found.dart`: long press triggers the display of the lists the product belongs to
* `user_preferences.dart`: added a preference for "copy/paste"
* `user_preferences_model.dart`: added method `getReferenceAttribute`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant