Questions tagged [riverpod]

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

1086 questions
4
votes
2 answers

Combining FutureProviders using a FutureProvider RiverPod

I am currently making the Udacity Sunshine project in Flutter. I have two different provider to fetch current temperature and daily forecasts. I want to combine the two providers and make a new single provider called weatherProvider. File:…
Ariel
  • 2,471
  • 1
  • 26
  • 43
4
votes
1 answer

How to override the state of a Riverpod StateNotifier for testing

I want to override my StateNotifierProvider state manually for testing. Overriding providers can be done using ProviderContainer or ProviderScope. But it only gives the option to override the notifier, not the state. My question is how should I…
NirmalCode
  • 2,140
  • 1
  • 14
  • 19
4
votes
1 answer

Is it possible to have multiple Riverpod ChangeNotificationProviders of the same exact type?

I've successfully built a NewsScreen around the riverpod ChangeNotificationProvider to poll data from a REST api and then create a listview. My app has multiple pages controlled by bottom tab navigation. In two of the tabs I want to show the…
Mark
  • 3,653
  • 10
  • 30
  • 62
4
votes
2 answers

Flutter TextField is losing data when focus changes

I have textformfields like this : If i don't define a keyboardType for the second textformfield, there is no problem when i go through from first one to second field, i don't lose the first field's input. But if i define keyboardtype in my code, it…
devberkay
  • 144
  • 13
4
votes
0 answers

hooks_riverpod: Flutter Firebase auth with Riverpod, error occur: a provider tried to assign `null` to a non-nullable `exposedvalue`"

I try to implement Firebase Auth for Flutter according to this tutorial: https://youtu.be/vrPk6LB9bjo?t=393 The Widget should check whether the user is login using riverpod hook method and provider and load either HomeScreen or LoginScreen…
asian_gang
  • 51
  • 4
4
votes
1 answer

Flutter-Riverpod - how to combine providers to filter on a Stream

I'm trying to follow the example docs on how to combine Providers using Flutter & Riverpod to filter a list of items. The data is coming from Firestore using Streams: final carListProvider = StreamProvider.autoDispose>((ref) { final…
Matt
  • 317
  • 1
  • 5
  • 9
4
votes
2 answers

How do avoid markNeedsBuilder() error using Flutter_Riverpod and TextEditingControllers on TextFormFields?

The form below is using ConsumerWidget from the flutter_riverpod package to watch for updates on first/last name fields in a firebase stream provider. Then using TextEditingControllers I am both setting the watched text values in the fields and also…
Zelf
  • 1,723
  • 2
  • 23
  • 40
4
votes
2 answers

Flutter api login using riverpod

I'm trying to use riverpod for login with a laravel backend. Right now I'm just returning true or false from the repository. I've set a form that accepts email and password. The isLoading variable is just to show a circle indicator. I've run the…
stalwart1014
  • 451
  • 1
  • 9
  • 29
4
votes
3 answers

Flutter/Riverpod: UI not updating on state change within a StateNotifierProvider

The UI of my app is not updating when I know for a fact the state is changing. I am using the watch method from Riverpod to handle this, but the changes don't take effect unless I do a hot reload. I have a class HabitListStateNotifier with methods…
wolfeweeks
  • 355
  • 4
  • 12
4
votes
0 answers

Flutter: Asking Location permission pauses all app execution, how to let it run asynchronously

When my app requests location permission the entire app stops until the dialog is complete (e.g. if the permission dialog pops up during a page transition the transition will freeze mid transition until the dialog is resolved). Literally it causes…
Shazamo Morebucks
  • 478
  • 1
  • 8
  • 19
4
votes
1 answer

riverpod conditional provider state updates

I'm porting my app to river_pod, it's been great so far but I always stumble upon the same problem. There is some situations where I need a provider to update its state only conditionally depending on the new value acquired by the ref.watch. An…
Théo Champion
  • 1,701
  • 1
  • 21
  • 46
4
votes
2 answers

Flutter navigationBar with Riverpod

I try to manage my states but I can't really do it. I would like to learn how to create a navigation bar at the bottom of the manage page with the riverpod package. I manage to manage the page on which we click but I do not see how to then return…
xenos92
  • 231
  • 6
  • 26
4
votes
1 answer

Equivalent of ChangeNotifierProvider widget in Riverpod

Is there a widget equivalent of the ChangeNotifierProvider widget of Provider in Riverpod? The use case is to create a provider only when a page whose parent widget is ChangeNotifierProvider/or a page that has ChangeNotifierProvider in its widget…
4
votes
1 answer

Flutter Riverpod StateNotifierProvider: only watch changes for part of a model

I have a model like this: class TimerModel { const TimerModel(this.timeLeft, this.buttonState); final String timeLeft; final ButtonState buttonState; } enum ButtonState { initial, started, paused, finished, } And here is the…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
3
votes
1 answer

Mutable variable in a Custom Class Provider Riverpod Flutter

I kinda new to Flutter and I'm using Riverpod. Is it okay (good) to have a mutable variable inside a class that I pass in using Provider? My Provider final groupControllerProvider = Provider((ref) { return…
Kenny
  • 33
  • 3