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

docs(example): add a simple grocery list app example that uses local persistence #3930

Open
thisissandipp opened this issue Jan 14, 2025 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@thisissandipp
Copy link

Describe what scenario you think is uncovered by the existing examples/articles

Many applications require persistent data storage alongside reactive data management. While Riverpod simplifies working with futures and streams, a comprehensive example that demonstrates using Riverpod for handling and managing locally stored entities (for example groceries, todos, or bookmarks) is missing in the docs.

Describe why existing examples/articles do not cover this case

The existing example around todo explains how to use NotifierProvider and StateNotifier. I'd say it's basic, limited to in-memory states, and does not cover combining Riverpod with storage solutions like SharedPreferences.

Additional context

How about an example grocery list application (as there is already a todos example)? It can have the following features

  • add a grocery item to the list (which will eventually be stored in the local storage)
  • read all the added grocery items (a stream that returns a list of items from storage)
  • make an item as bought/completed (updates and persists updated state)
  • remove/delete an item
  • add a filter (to buy, already bought, bought in the past week, etc)
@thisissandipp thisissandipp added documentation Improvements or additions to documentation needs triage labels Jan 14, 2025
@rrousselGit
Copy link
Owner

I'd rather not add a persistence example until I complete the persistence feature in Riverpod.

Once we have it, we can update the existing examples to use persistence.

@thisissandipp
Copy link
Author

Cool, I didn't know about this - definitely sounds exciting.

How about a Firebase login example? It can showcase integrating other packages, managing authentication states with streams, error handling/displaying error messages, and dynamic view switches based on users' auth states.

This could demonstrate a real-world use case. Additionally, I think the docs should include tutorials instead of direct links to the example repository. The docs explain everything topic by topic, but a structured tutorial would make it easier for beginners and intermediate devs to follow along and learn important topics.

Here are some libraries that have included their examples as a form of tutorials

What do you think about it?

@rrousselGit
Copy link
Owner

Sure. That's a quite different topic from local persistence though

@thisissandipp
Copy link
Author

You are right. I should have created a separate issue for this topic. Let me go ahead and do that so that we can keep the discussions focused.

Let me know how you’d like to proceed with the current issue - whether to keep it as a placeholder for future persistence examples or handle it differently.

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

No branches or pull requests

2 participants