Questions tagged [flutter-riverpod]

166 questions
0
votes
1 answer

How to periodically fetch data from an api(CoinGecko) in Flutter. -With Riverpod-

I want to fetch data from coin gecko with its api. Using FutureProvider to do this. FutureProvider only fetches the data once. So the data comes and UI builds successfully.However, I want to listen all changes on each cryptocurrency, and rebuild the…
Arjein
  • 25
  • 8
0
votes
0 answers

Watching a StateNotifier doesn't catch the next state

I have this suffix icon: Widget suffixIcon(BuildContext context) { final isLoading = provider.watch(boolProvider); return isLoading ? SizedBox( width: SUFFIX_ICON_WIDTH_LENGTH, height:…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
0
votes
0 answers

Using Riverpod code generator on a class and overriden build() method

I am migrating my current Flutter app to riverpod 2.0. I have a provider that contains a class. I call the asynchronous methods in that class and render UI by watching that provider as you know. When I use riverpod code generator with the @riverpod…
0
votes
1 answer

Riverpod provider with fetch-once async call

I am using Riverpod 2 provider to get value from a Future Provider as shown below. @riverpod Future fetchCurrentUser(FetchCurrentUserRef ref) async { // usersRef is the Firebase ODM refence here final ref = await…
Purus
  • 5,701
  • 9
  • 50
  • 89
0
votes
1 answer

How do I know for sure that a stream is disposed when terminating Flutter app?

I am using RiverPod in the following basic app which listens to intStreamProvider. How do I know for sure that the stream is disposed when I terminate the app. Currently, when the app starts, this message is printed to the console "===> created…
Aimn Blbol
  • 907
  • 11
  • 20
0
votes
0 answers

The getter 'notifier' isn't defined for the type 'FutureProvider'.?

When I user ref.read(authLoadingProvider.notifier).update((state) => false); like below, flutter returns error like The getter 'notifier' isn't defined for the type 'FutureProvider'. Try importing the library that defines 'notifier',…
SugiuraY
  • 311
  • 1
  • 9
0
votes
1 answer

flutter) Duplicate events occur in stream

I am developing an app by combining riverpod and stream. However, I receive the same event twice. To avoid duplicate reception, the stream is listened to in initState. However, a duplicate event occurred. I checked it by taking breakpoints in debug…
Queen Ellery
  • 481
  • 1
  • 6
  • 11
0
votes
2 answers

How to create a search field in Flutter?

I am using the flutter_riverpod package. I'm using it for a search field and it's showing an error when searching for something. I asked a question about the error but couldn't fix it. Is there any other way to create a search field in Flutter using…
My Car
  • 4,198
  • 5
  • 17
  • 50
0
votes
0 answers

What kind of changes does "ref.watch(FutureProvider)" detect?

I'm really confusing that what is ref.watch(authUserFutureProvider);//here below detecting. When final user = FirebaseAuth.instance.currentUser; // here set appropriately, ref.watch(authUserFutureProvider);//here detect the changes in the…
SugiuraY
  • 311
  • 1
  • 9
0
votes
0 answers

Riverpod StateNotifierProvider with autoDispose throw an error "Invalid argument: Maximum call stack size exceeded" on FLUTTER WEB

StateNotifierProvider with autodispose run on android, but on flutter web its throw this error : Can't we call the autodispose func on StateNotifierProvider ? How to reproduce the error : create a state notifier provider with autoDispose : final…
Sayyid J
  • 1,215
  • 1
  • 4
  • 18
0
votes
0 answers

ProxyProvider2 in Riverpod (the provider must be created on startup)

I am using the game template of Flutter casual game. Flutter casual game template: Link They are using a provider actually. They have this: ProxyProvider2, AudioController>( …
0
votes
0 answers

how to mock the state of a StateNotifierProvider flutter

my test is throwing an exception because there is a StateNotifierProvider inside which is not overridden. for a regular Provider, i can override it using providerContainer, but for the state of a stateNotifierProvider, I don't know how to do it. I…
john
  • 1,438
  • 8
  • 18
0
votes
0 answers

Is StateNotifierProvider only for when you update the UI?

In Riverpod, if you have a class that has dynamic state, but you don't need to display changes to the state in the UI, do you use a StateNotifierProvider or just a plain Provider? Because StateNotifierProvider provides a hook to update the state of…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
0
votes
0 answers

Can I wrap MultiProvider as a child of ProviderScope in the main function in Flutter App?

I want to use flutter_riverpods and go_router in my app to manage the state of the bottomNavigationBar and enable signing out of the whole app from the settings page which is in the bottomNavigationBar. How can I integrate ProviderScope in the app?…
0
votes
1 answer

Is it necessary to use StateNotifier even if there is only one value and no method?

If there is only one value and no method, do we still need to use StateNotifier as follows? Or is there a simpler mechanism? Since this value is rewritten and referenced from the outside, the corresponding function must be included in the…