Feature: Search with local OpenFoodFacts database file#319
Open
manum45 wants to merge 15 commits intosimonoppowa:developfrom
Open
Feature: Search with local OpenFoodFacts database file#319manum45 wants to merge 15 commits intosimonoppowa:developfrom
manum45 wants to merge 15 commits intosimonoppowa:developfrom
Conversation
added 15 commits
April 3, 2026 00:52
Author
|
I think this app could be made to work fully offline.
Do you think this is a valuable feature? What would be required from your perspective? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Recently the OpenFoodFacts search API often isn't working, due to rate limiting or server issues. See https://status.openfoodfacts.org/. See also #157 and #229.
A new API seems to be planned, but I couldn't find any info on a timeline.
This pull request provides the option to search in a local database file (subset of the OpenFoodFacts database) to avoid using the search API. Nutrition details of a product are then fetched via the Barcode API when a product is select in the search results list. The barcode API seems to be a lot more reliable.
The database for search is roughly 230MB and could probably be reduced further.
This feature could also be extended so that the app can be used fully locally with the full OFF database, however this is 4GB (although some reduction should be possible, e.g. unused info, other languages, ...).
Usage description is available in
Local_OpenFoodFacts_Database.md.Open topics
I wanted to get some early feedback, especially on these points:
lib/features/add_meal/data/dto/off/off_product_dto.g.dart:OFFProductDTOFromJson(). I think this is described in [Bug] Query crashes during OFF search when products have missing nutriments data #306. What would be the right way to solve this?Testing
I have tested this roughly my Android phone, and will daily drive it for the next days.
I don't have an iPhone, so I am not able to test it there.