Questions tagged [flutter-riverpod]
166 questions
2
votes
0 answers
Riverpod 2.0: Correct way to use ProviderScope without causing UnimplementedError
In my app I have a top-level ProviderScope widget which wraps my MaterialApp. Inside my HomePage, I'm using another Navigator widget, in which I use a switch case to manage routes. In this case, I'm following the marvel example from the riverpod git…

Alan Cesar
- 370
- 3
- 13
1
vote
1 answer
Flutter Riverpod Async Notifier | Unhandled Exception: Bad state: Future already completed
I am using the riverpod_generator, and the AsyncNotifier in riverpod
part 'auth_controller.g.dart';
// 3. annotate
@riverpod
// 4. extend like this
class AuthController extends _$AuthController {
// 5. override the [build] method to return a…

Mosh Mobile Software Engineer
- 217
- 3
- 12
1
vote
1 answer
why do my flutter app exception keep getting uncaught
i am using am using flutter and retrofit with riverpod as a statemanagement but anytime i try to run my code it get uncaught and point to the generated file anytime i use a future provider. code below
final customCategoryFutureProvider =
…

olu
- 93
- 7
1
vote
1 answer
AsyncLoading VS AsyncValue.loading
I am trying to create Auth and Todo app.
The problem is that I don't know which is the correct usage and
don't know the difference between the two.
I want to use it before adding an item to the Todo List.
Is there a clear distinction between them,…

issei Hiramatsu
- 13
- 2
1
vote
1 answer
Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe. At this point the state of the widget's element tree is no longer stable
Hey I am building an app in flutter and when I run google sign in it gives me error that
E/flutter (30710): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
E/flutter…

abhi jain
- 41
- 1
- 5
1
vote
0 answers
Flutter Riverpod 2.0 - how to emit (add) a value to a stream provider manually (through user input)?
i'm learning riverpod but i'm facing alot of problems because the lack of examples.
i have the following:
a class called CounterState1 which contains a stream that emits an integer.
a provider for CounterState1.
a stream provider for…

MohaAmiry
- 21
- 1
1
vote
0 answers
Riverpod FutureProvider - passing result between screens
I'm learning Riverpod provider and stuck on a topic regarding passing values between screens.
As I learnt from Riverpod docs - it delivers a provider that enables values to be accessed globally... and here is my case.
I'm creating a service repo,…

dave
- 11
- 2
1
vote
1 answer
List of interactive items using nested StateNotifiers
Do you think it's okay to have a list of StateNotifiers inside the State of other StateNotifier?
For example like this:
class ListOfItems extends StateNotifier {
void doSomethingWithList() {
// update state of list -> rebuild…

Igor' Leonidov
- 11
- 2
1
vote
1 answer
Flutter Riverpod StreamProvider not waiting for for loop to finish before building Widget
I have a StreamProvider here:
final secondTabProvider = StreamProvider((ref){
EmergencyContactsController contacts = EmergencyContactsController(currentUserID: ref.read(authProvider).currentUser!.uid);
return…

Dre Day
- 25
- 8
1
vote
3 answers
How to use a Riverpod provider in initState
I use Riverpod as state management in my web app. I am trying to build an AppBar that scrolls automatically to certain parts of a ListView.
I created a ScrollController as a provider for this purpose.
final scrollControllerProvider =…

JAgüero
- 403
- 1
- 4
- 14
1
vote
1 answer
How to do another API call after get the response of first one using Riverpod?
I have two APIs. The first one is giving drawList which has the List and the second one is giving a filter for the particular draw which I get in the first API's response.
API 1: /draws/list
API 2:…

Shweta
- 141
- 8
1
vote
1 answer
update StateProvider with flutter_riverpod
Is it possible to update StateProvider from the Class outside the Widget?
Or I need to use another way?
My code
class SettingScreen extends ConsumerWidget with WidgetsBindingObserver {
This is the place I would like to update the state
Widget…

Kobi
- 127
- 1
- 11
1
vote
1 answer
Flutter Null check operator used on a null value even after checking conditionally for null values
I have a Flutter + Riverpod project in which I am fetching some data when a screen loads. Getting the Null check operator error but I am checking if the value is null or not beforehand. State has a nullable field currentlyReading which is null at…

Ritik Kumar
- 25
- 4
1
vote
1 answer
Flutter/Riverpod - how to combine providers for fetching data list and holding the data list as state?
I've been playing with the RiverPod 2.0 state management package to understand how to use it for CRUD type operations
What I can't understand is how to use the range of providers to support..
The asynchronous loading of a data object list prior to…

user2868835
- 1,250
- 3
- 19
- 33
1
vote
1 answer
Flutter / RiverPod - how to load StateProvider initial state from Firestore
I'm stuck with a situation where I am trying to use a RiverPod provider in my Flutter app to represent user preference data. In this case, the user preference data is stored in FireStore.
I'm stuck with understanding how to load provider state from…

user2868835
- 1,250
- 3
- 19
- 33