Questions tagged [riverpod]

For questions relating to the "riverpod" package for the Flutter framework.

1086 questions
5
votes
0 answers

Consumer widget is not rebuilding the UI when state updates

I am using flutter riverpod(State Notifier Provider) for state management. When I am updating the state the consumer widget is not rebuilding itself because of which the UI is not getting updated even though my state is getting updated. I am unable…
shekhar s
  • 51
  • 1
  • 3
5
votes
1 answer

How to modify the state of a StateNotifier Provider from another provider in Riverpod?

Im very new to flutter and riverpod so im very sorry if the question is not clear, let me know if this is the case I have 2 providers, one listens to real-time changes of a FireStore collection, and the other one is a List Service to handle the…
neonx97
  • 53
  • 1
  • 4
5
votes
1 answer

how to make more than one asynchronous calls when open a page using Riverpod?

when the user of my app open the Home page, I need to make two asynchronous calls to the server first, I need to get current user data. and then based on the current user data, I need fetch his favorite restaurants. I have two separate methods to…
Alexa289
  • 8,089
  • 10
  • 74
  • 178
5
votes
1 answer

How to read StateNotifierProvider.family without passing value?

I have implemented StateNotifierProvider with ".family" modifier: class OrderReviewNotifier extends StateNotifier { final OrderReviewRepository repository; OrderReviewNotifier( this.repository, int orderId, ) :…
Viacheslav
  • 116
  • 1
  • 5
5
votes
1 answer

How to initialize stateProvider from constructor in RiverPod

Basically, I want to set the initial constructor value to StateProvider so I can use it in its child widgets. final stateProvider = StateProvider((ref) => "default"); class ExampleWidget extends ConsumerWidget { ExampleWidget({required String…
Kartik Garasia
  • 1,324
  • 1
  • 18
  • 27
5
votes
0 answers

Flutter app crashing after Firebase logout

iam still really new to Flutter. Iam using Riverpod together with Firebase and getting some crash after trying to logout. If someone could help it would be awesome! If its just a noob mistake iam sorry already:D My main.dart looks like this: void…
Kilian
  • 161
  • 1
  • 5
5
votes
1 answer

stateNotifier for multiple states with riverpod

I'm confused about how to use stateNotifier with riverpod. Most of the tutorials out there uses the counter example which is good but still not that clear to me. I'm trying to implement a stateNotifier with 2 states : isDrawerOpen and isDrawerColor…
stalwart1014
  • 451
  • 1
  • 9
  • 29
5
votes
1 answer

Flutter Riverpod Setting a Value Without Context

I have an app where a video uploading progress indicator needs to be shown on the Feed Screen. The code that returns the upload progress is in a Video Client Class that is not in the widget tree of the Feed Screen and the Feed Screen is not even…
Nicholas Muir
  • 2,897
  • 8
  • 39
  • 89
5
votes
1 answer

Flutter changing Text value using RiverPod State management

In this below code i made simply code to change Text widget string, default string can be shown into Text widget but when i try to click FloatingActionButton is doesn't change. clicking on HotReload cause chage it to new value, where i should change…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
4
votes
2 answers

Why is ref.watch(otherProvider.stream) deprecated in Riverpod 2.x and will be removed in 3.x?

I'm using Riverpod to listen to changes to a selected item from my store: I have a repository PlacesStore which has a Stream watchPlace(PlaceId placeId) method. I have wrapped this in a family provider like…
Rik
  • 790
  • 8
  • 11
4
votes
0 answers

Riverpod: overriding and watching prevents listening on a dependent provider

Here is a very curious case with Riverpod which is probably a bug. The existence of a simple watch line prevents a listen from executing. When watching a base provider and listening to a provider that depends on it, listen only executes if you do…
Gazihan Alankus
  • 11,256
  • 7
  • 46
  • 57
4
votes
2 answers

Riverpod trigger rebuild when update state with freezed copywith even if nothing changed

I thought Riverpod will only trigger rebuild if the state value is different but turn out it rebuild every time when state is set although the value is the same. Is that true? The case is as below @Freezed(genericArgumentFactories: true) class Model…
Anson Wong
  • 1,034
  • 8
  • 10
4
votes
0 answers

How to listen the riverpod with family

I have this provider with family final gameControllerProvider = ChangeNotifierProvider.autoDispose .family((ref, gameLevel) { final gameController = GameController()..initializeController(gameLevel, ref); return…
4
votes
3 answers

Flutter: how to listen to GoRouter's route / location changes in a Riverpod provider?

I am developing a Flutter application with go_router and riverpod for navigation and state management respectively. The app has a widget which displays a live camera feed, and I'd like to "switch it off" and free the camera when other pages are…
Michele
  • 2,148
  • 1
  • 9
  • 14
4
votes
1 answer

How to use riverpod to force a new build of widget

I'm working on a Flutter app using Riverpod for the state management and go_router for the routing. I'm trying to make a view model for my screen, because my screen need 3 differents async state (a user, a board game, and another request to the…
Collembole
  • 158
  • 2
  • 13