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

Clarification Needed on Transitioning from ChangeNotifierProvider to NotifierProvider #3885

Open
stephane-archer opened this issue Dec 22, 2024 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation needs triage

Comments

@stephane-archer
Copy link

from ChangeNotifierProvider https://riverpod.dev/docs/providers/change_notifier_provider

Using ChangeNotifierProvider is discouraged by Riverpod and exists primarily for:
an easy transition from package:provider when using its ChangeNotifierProvider
supporting mutable state, even though immutable state is preferred
info
Prefer using NotifierProvider instead.
Consider using ChangeNotifierProvider only if you are absolutely certain that you want mutable state.

The documentation for ChangeNotifierProvider states that its usage is discouraged in favor of NotifierProvider. While this is understandable, I’d like some clarification on the following points:

  • When transitioning to Riverpod, how significant is it to eventually replace ChangeNotifierProvider with NotifierProvider? Are there any specific problems or limitations with continuing to use ChangeNotifierProvider long-term?
  • What capabilities or advantages does NotifierProvider offer that ChangeNotifierProvider lacks?
  • The documentation mentions that mutable state is discouraged in Riverpod. Why is mutable state seen as an issue in Riverpod, when it was not a problem with package:provider?

I think these details could help provide a clearer understanding for developers transitioning from package:provider to Riverpod. Expanding the documentation to address these points would be very helpful.

Thank you for your time and the work you’ve put into Riverpod!

@stephane-archer stephane-archer added documentation Improvements or additions to documentation needs triage labels Dec 22, 2024
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 needs triage
Projects
None yet
Development

No branches or pull requests

2 participants