For questions relating to the "riverpod" package for the Flutter framework.
Questions tagged [riverpod]
1086 questions
3
votes
2 answers
Flutter Riverpod StateNotifierProvider Async value still loading
I'm new to Flutter. I use the Riverpod state management library. I am calling a remote API to get a list of board games. If I don't pass a parameter to my query, it returns me a list of popular games, and if I pass a games name parameter, it returns…

Collembole
- 158
- 2
- 13
3
votes
1 answer
How to change state value without rebuilding the widget in Flutter using riverpod?
I am using riverpod package for state management in a Flutter app and I have a search sort provider as follows:
final searchSortStateProvider = StateProvider((ref) { return SearchSort.relevance; });
But when the user searches again I…

Simple Code
- 2,354
- 2
- 27
- 56
3
votes
1 answer
Flutter Web, Riverpod and GoRouter, How to access state notifier from within GoRouter
I want users on my app to be able to deep link onto profile pages, for example the user might go to "www.myapp.com/#/users/{userId}", and I want my gorouter to be detect the {userId} variable from the uri, and then feed that data into a state…

Shazamo Morebucks
- 478
- 1
- 8
- 19
3
votes
1 answer
Provider was disposed before a value was emitted
I wrote the following code and encountered the error The provider AutoDisposeFutureProvider#d1e31(465-0041) was disposed before a value was emitted.
I thought it was strange, so I debugged FutureProvider's onDispose and found that it was…

hime_chann____
- 141
- 1
- 5
3
votes
4 answers
How do I get loading state/spinner with flutter riverpod statenotifier, ref watch and asyncvalue?
I have the below example which does refresh the data but does not give a spinner as expected.
I tried using ref.listen to switch to async loading, i tried await in front of the call even though it didn't make sense.
I tried ref.refresh,…

nAndroid
- 862
- 1
- 10
- 25
3
votes
1 answer
how to use listview with riverpod in flutter
I'am developing an app with flutter and flutter_riverpod. I want to use listview with riverpod. But I don't know how to use. I have an onSubmitted method of textfield. This method to work some dart code for texffield text. My purpose is save the…

mesh
- 174
- 1
- 1
- 10
3
votes
0 answers
How can a provider shared on multiple pages update only the current page?
I have an app with multiple pages and a filter that is shared on all of them. When the filter is changed it triggers an update on all the pages.
As an example this are the providers that use the same filter (filterProvider):
final provider1 =…

Eric Valero
- 540
- 5
- 8
3
votes
1 answer
What is the advantage of using dependency injection with providers in Flutter's riverpod?
I often see people talking about using riverpod when defining dependencies for each class in flutter.
final apiClientProvider = Provider.autoDispose(
(_) => GithubApiClientImpl(),
);
final githubRepositoryProvider = Provider.autoDispose(
(ref)…

hime_chann____
- 141
- 1
- 5
3
votes
1 answer
Riverpod: How do you manage loading and error states with StateNotifier?
How to use loading/error states with StateNotifier like we do with FutureProvider in Riverpod?
We can do the same with Provider using setState, var isLoading with ternary operator and didChangeDependencies.

Anmol Singh
- 393
- 3
- 16
3
votes
0 answers
How to use Riverpod Watch and Navigate with NavigatorState?
I'm watching a simple authentication provider created using Riverpod in a Flutter app, that will then use NavigatorSate to either navigate to the home page, or the sign in page, depending on whether the user is authenticated. I've create a simple…

Blue Waters
- 725
- 1
- 4
- 17
3
votes
2 answers
Riverpod - How to access a provider in a test?
I have this snippet:
final countProvider = StateProvider((ref) {
return 0;
});
class CountWidget extends ConsumerWidget {
const CountWidget();
@override
Widget build(BuildContext context, WidgetRef ref) {
final count =…

Valentin Vignal
- 6,151
- 2
- 33
- 73
3
votes
2 answers
Flutter CircularProgressIndicator() animation is not working inside Riverpod`s ref.watch().when
CircularProgressIndicator Screen Shot
I'm using Riverpod for state-management
CircularProgressIndicator occupies only 4 pixels under any conditions
I tested on a physical device and on an emulator
import 'package:flutter/material.dart';
import…

Chu Chun
- 35
- 6
3
votes
2 answers
Riverpod: notifier vs state - difference?
I am unable to find the difference between:
ref.read(moveFieldNotifierProvider.notifier).state = something;
and
ref.read(moveFieldNotifierProvider.state).state = something;

Sunil Gupta
- 666
- 6
- 20
3
votes
2 answers
flutter riverpod question: watch a provider from another provider and trigger action on the first provider
I am trying to figure out how can i watch a StateNotifierProvider and trigger some methods (defined in the class subclassing StateNotifier) on this provider after having done some async computations in another Provider watching the…

Enzo Scossa-Romano
- 77
- 1
- 6
3
votes
2 answers
What is the efficient way to pass arguments to a Riverpod provider each time it gets initialized in Flutter?
I am currently trying to create an instance of a widget's state (ChangeNotifier) using a global auto-disposable ChangeNotifierProvider. The notifier instance takes in a few arguments to initialize each time the UI is built from scratch.
Let's assume…

Deniss Zerkalijs
- 88
- 1
- 6