-
-
Notifications
You must be signed in to change notification settings - Fork 959
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
Update random number example from StateNotifier to NotifierProvider #3790
Conversation
WalkthroughThe changes involve a significant refactor of the Changes
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
🧹 Outside diff range and nitpick comments (1)
examples/random_number/lib/main.dart (1)
11-12
: Update comments to reflect Notifier and NotifierProviderThe comments still reference
StateNotifier
andStateNotifierProvider
. To maintain clarity and prevent confusion, please update the comments to reflect the use ofNotifier
andNotifierProvider
.Apply this diff to update the comments:
-// State notifier for generating a random number exposed by a state notifier -// provider +// Notifier for generating a random number exposed by a NotifierProvider ... -// State notifier provider holding the state +// NotifierProvider holding the stateAlso applies to: 21-22
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- examples/random_number/lib/main.dart (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
examples/random_number/lib/main.dart (2)
12-15
: Successfully migrated to NotifierThe
RandomNumberGenerator
class has been correctly updated to extendNotifier<int>
, with thebuild()
method properly initializing the state with a random integer. This aligns with the latest Riverpod patterns and ensures proper state management.
22-22
: Provider updated to NotifierProviderThe
randomNumberProvider
has been appropriately updated to useNotifierProvider
withRandomNumberGenerator.new
. This change reflects the migration fromStateNotifierProvider
toNotifierProvider
and is consistent with the updated notifier implementation.
Thanks! |
Related Issues
fixes #your-issue-number
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).I have updated the
CHANGELOG.md
of the relevant packages.Changelog files must be edited under the form:
If this contains new features or behavior changes,
I have updated the documentation to match those changes.
Summary by CodeRabbit
New Features
Refactor
StateNotifier
toNotifier
for better alignment with current best practices.