-
-
Notifications
You must be signed in to change notification settings - Fork 974
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
add a tip to avoid beginer mistake #3884
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request updates the Riverpod migration documentation in the quickstart guide, focusing on providing clearer, more detailed guidance for developers transitioning from the Provider package to Riverpod. The changes emphasize a gradual, incremental migration approach, offer clarifications about using Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
website/docs/from_provider/quickstart.mdx (1)
55-58
: Enhance the tip with a code example.The tip effectively warns about a common migration pitfall. To make it even more helpful, consider adding:
- A code example showing the incorrect vs correct usage:
+ ```dart + // ❌ Wrong - Riverpod's ChangeNotifierProvider doesn't have create + import 'package:riverpod/riverpod.dart'; + ChangeNotifierProvider(create: (_) => MyNotifier()); // Error! + + // ✅ Correct - Provider's ChangeNotifierProvider has create + import 'package:provider/provider.dart' as provider; + provider.ChangeNotifierProvider(create: (_) => MyNotifier()); + ```
- A brief explanation of why this error occurs (different APIs between packages)
@@ -52,6 +52,11 @@ Take your time, as it is important to get yourself familiar with Riverpod first; | |||
you'll quickly find out that *almost* all Providers from pkg:provider have a strict equivalent in pkg:riverpod. | |||
::: | |||
|
|||
:::tip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be better to update the snippets to include imports, with prefixes.
It both suggests using prefixes and makes it cleared which package we're referring to when reading the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provider would probably not have a prefix during a transition. Only Riverpod will have them. is riverpod_lib
a good prefix for the doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a prefix on the provider import.
import 'package:provider/provider.dart' as provider;
@@ -52,6 +52,11 @@ Take your time, as it is important to get yourself familiar with Riverpod first; | |||
you'll quickly find out that *almost* all Providers from pkg:provider have a strict equivalent in pkg:riverpod. | |||
::: | |||
|
|||
:::tip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a prefix on the provider import.
import 'package:provider/provider.dart' as provider;
Summary by CodeRabbit
ChangeNotifierProvider
and clarified import prefixes.ProxyProvider
s.ChangeNotifier
.