-
Notifications
You must be signed in to change notification settings - Fork 736
[deps] Update dependency flutter_riverpod to v3 #4380
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
Conversation
|
Nah, this won't just work like that:
See https://riverpod.dev/docs/whats_new. We should probably update at some point, but this is new and I wonder if we should wait a little. OTOH
So maybe we shouldn't wait too long. @levkropp opinions? |
|
I asked for support plans: rrousselGit/riverpod#4319 |
|
The owner replied:
So I guess we need to adapt... |
8ef03af to
91a31dc
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4380 +/- ##
=======================================
Coverage 89.39% 89.39%
=======================================
Files 253 253
Lines 16457 16457
=======================================
Hits 14711 14711
Misses 1746 1746 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d600e97 to
c4afca2
Compare
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
8b7def1 to
5296a3b
Compare
6efadd5 to
247c0fd
Compare
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.
Just a few little nitpicks 😄
Also, I think a dart pub upgrade could be run. Building the GUI locally creates a diff in pubspec.lock Also also, had to rebase on main in order to get the GUI working on macOS.
247c0fd to
65e0df2
Compare
6699cd4 to
e1ee3c0
Compare
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.
Awesome! Thanks, @levkropp
networksProvider was a synchronous Provider that
triggered an async operation and then called
ref.invalidateSelf() when it completed.
This created an infinite loop:
Provider builds → triggers network request
Request completes → calls invalidateSelf()
Provider rebuilds triggers another network request
And so on...
Solution: Changed networksProvider from a Provider
to a FutureProvider that properly handles async
Updated virtualization_settings.dart to handle the
async result with valueOrNull ?? const <String>{}
The recommended way to update StateProviders to riverpod v3 is to create a Notifier that is provided by a NotifierProvider This also removes the dependency on legacy.dart
When closing a terminal, the Ref of NotifierProvider<TerminalNotifier> was being read after it has been disposed. This change checks if the ref is mounted or not before attempting to read it
9defdb9 to
e85fe23
Compare
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.
Pull Request Overview
This PR updates the flutter_riverpod dependency from version 2.6.1 to 3.0.1, along with related dependency updates (fl_chart and vector_math). The main changes involve migrating state management code to be compatible with Riverpod v3's new API patterns.
Key changes:
- Migration from
StateProvidertoNotifierProviderwith explicitNotifierclasses - Migration from
AutoDisposeFamilynotifiers toNotifierwith explicit constructor parameters - Updates to async provider handling using
.when()instead of.valueOrNull
Reviewed Changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pubspec.yaml | Updated flutter_riverpod to ^3.0.1, fl_chart to ^1.1.1, and added vector_math ^2.2.0 dependency override |
| lib/vm_table/vms.dart | Converted StateProvider to NotifierProvider with RunningOnlyNotifier and SelectedVmsNotifier classes |
| lib/vm_table/vm_table_headers.dart | Updated state mutations to use new notifier methods |
| lib/vm_table/search_box.dart | Converted SearchNameNotifier to use NotifierProvider pattern |
| lib/vm_table/header_selection.dart | Migrated EnabledHeadersNotifier to NotifierProvider |
| lib/vm_details/*.dart | Updated all VM details components to use .when() for async state and new notifier patterns |
| lib/tray_menu.dart | Converted DaemonVersionNotifier to NotifierProvider |
| lib/sidebar.dart | Migrated sidebar state notifiers to NotifierProvider pattern |
| lib/settings/*.dart | Updated settings components to handle async state with .when() |
| lib/providers.dart | Major refactoring of provider definitions to use Riverpod v3 patterns, including SharedPreferences provider |
| lib/notifications/notifications_provider.dart | Converted NotificationsNotifier to use new Notifier base class |
| lib/main.dart | Updated provider overrides to use new SharedPreferences provider pattern |
| lib/extensions.dart | Migrated HoveredLinkNotifier to NotifierProvider |
| lib/catalogue/*.dart | Updated image launching and catalogue providers to Riverpod v3 patterns |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| VmScreenLocationNotifier(this.arg); | ||
| final String arg; |
Copilot
AI
Oct 21, 2025
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.
[nitpick] The constructor parameter naming is inconsistent with other notifiers in the codebase. Consider renaming arg to a more descriptive name like name to match the semantic meaning (it represents a VM name) and improve code readability.
| VmScreenLocationNotifier(this.arg); | |
| final String arg; | |
| VmScreenLocationNotifier(this.name); | |
| final String name; |
| errorReceiver.close(); | ||
| exitReceiver.close(); | ||
| stop(); | ||
| // Don't call stop() here - it will be handled by dispose |
Copilot
AI
Oct 21, 2025
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.
The comment mentions a stop() method that doesn't appear to exist in the visible code. This could be referring to removed code or a method defined elsewhere. Consider clarifying what cleanup is being deferred to dispose, or update the comment if the method no longer exists.
| // Don't call stop() here - it will be handled by dispose | |
| // Don't perform cleanup here - it will be handled by _dispose via ref.onDispose |
| ref.state = networks.map((n) => n.name).toBuiltSet(); | ||
| }).ignore(); | ||
| final networks = await ref.watch(grpcClientProvider).networks(); | ||
| return BuiltSet<String>(networks); |
Copilot
AI
Oct 21, 2025
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.
The networks variable is a list of network objects with a name property, but this code attempts to create a BuiltSet<String> directly from that list. The .map((n) => n.name) transformation that existed in the old code is missing, which will cause a type error. Should be: return networks.map((n) => n.name).toBuiltSet();
| return BuiltSet<String>(networks); | |
| return networks.map((n) => n.name).toBuiltSet(); |
| ref | ||
| .read(driverProvider.notifier) | ||
| .set(value!) | ||
| .set(value as String) |
Copilot
AI
Oct 21, 2025
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.
Using a type cast with as String is risky here. Since the null check if (value == driver) return; already ensures value is not null at this point, consider using the null assertion operator value! instead for clarity, or better yet, add a null check before the if statement to avoid the cast entirely.
| .set(value as String) | |
| .set(value!) |
| final currentSize = ref.read(sessionTerminalFontSizeProvider); | ||
| final newSize = min(currentSize + fontSizeStep, maxFontSize); | ||
| ref.read(sessionTerminalFontSizeProvider.notifier).set(newSize); | ||
| return null; |
Copilot
AI
Oct 21, 2025
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.
[nitpick] The CallbackAction.onInvoke callback now requires an explicit null return for Riverpod v3 compatibility. While this is correct for the migration, consider documenting why null is returned or if there's a more semantic return value that could be used.
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.
LGTM (secondary). Built and tested the GUI in Ubuntu 24.04, found no regressions.
Note
Mend has cancelled the proposed renaming of the Renovate GitHub app being renamed to
mend[bot].This notice will be removed on 2025-10-07.
This PR contains the following updates:
^2.6.1->^3.0.0Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
rrousselGit/riverpod (flutter_riverpod)
v3.0.1Compare Source
v3.0.0Compare Source
Configuration
📅 Schedule: Branch creation - "every 2 weeks on Monday" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.