Skip to content

Add flexibility to PriceTotalStats #1058

Closed
@monsieurtanuki

Description

@monsieurtanuki

Why - Problem description

Currently in off-dart, we support less than 20 fields for PriceTotalStats.
And there are more than 50 fields on the server (https://prices.openfoodfacts.org/api/v1/stats).
In order to add the fields we would need to code, push the code, have it reviewed and merged and released.
That's due to the way it was coded, relying on JsonSerializable.

What - Proposed solution

A flexible solution would be to keep the JSON and just let the users get what they want.
Something like int? getInt(String tag).
We may also provide a list of static const String typical tags. If there's a new tag, we wouldn't need to release again: the users would be able to query that new tag regardless.

Additional context

cf. FlexibleProduct in #1056.
cf. openfoodfacts/smooth-app#6128
cf. openfoodfacts/smooth-app#6553

Metadata

Metadata

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions