1,470 questions
0
votes
0
answers
9
views
How to update Flutter riverpod to version >= 2 (using riverpod decorator)
I have a flutter app and I am using flutter_riverpod: ^2.5.1 ... And my code is:
import 'package:flutter_riverpod/flutter_riverpod.dart';
class PersonState {
int age;
String? name
PersonState({...
0
votes
1
answer
7
views
How to properly react to changes from other providers using Riverpod?
currently BatchSizeNotifier reset ProgressNotifier when it changes, but I would like ProgressNotifier to reset itself when BatchSizeNotifier changes by listening to it, but it doesn't seem to work.
...
0
votes
0
answers
54
views
Riverpod ref.read calls build method and returns initial state
In my flutter app I want to use InAppWebView and riverpod , So I created :
@riverpod
class WebViewController extends _$WebViewController {
@override
InAppWebViewController? build() {
return ...
1
vote
1
answer
52
views
Riverpod VSCode quick refactoring options are absent
Hello Please help with Riverpod.
Everything works on the command line (Code generation, etc)
But VSCode quick refactoring options are absent.
I have analysis_options.yaml with :
analyzer:
plugins:
...
0
votes
1
answer
44
views
Riverpod Annotations Compiler Errors
I have attempted to add Riverpod to a Flutter project and use its annotations which then produce errors. I then created a new project and followed exactly what the Getting Started shows, however, ...
0
votes
0
answers
32
views
flutter_hooks - how to access TextEditingController outside the build()-method?
Flutter hooks needs to be created within the build method of a widget by design.
Let's assume I have a hook for using a TextEditingController, how can I access the TextEditingController outside the ...
0
votes
0
answers
31
views
How to test two providers in Flutter / Riverpod?
I have 2 providers, Provider1 and Provider2, where Provider1 uses Provider2 in this way:
@riverpod
class Provider1Notifier extends _$Provider1Notifier with PersistenceHelper {
....
void buy(int ...
0
votes
1
answer
56
views
Moving my riverpods generated files to a dedicated folder
I'm doing some cleaning in my project, therefore I want to move my generated files to an other folder to improve the readability.
I've managed to move freezed files but not riverpod
This is my build....
0
votes
0
answers
19
views
Managing StreamChatClient Initialization and Connection with Riverpod: Architecture Advice
Background:
I’m using StreamChat in my Flutter app. The documentation mentions that the StreamChatClient should only be initialized once and client.connectUser() should only be called once to avoid ...
0
votes
2
answers
123
views
Riverpod problem with instantiating multiple providers of same type
This is more about a theoretical discussion of flutter riverpod state management package. Currently I am trying to migrate one kinda huge project from Provider to Riverpod and I encountered an issue ...
0
votes
1
answer
36
views
Duplicate Key error while using GoRouter StatefulShellRoute with redirect
I'm using GoRouter for navigation in my Flutter app, but while using the redirect function with StatefulShellRoute, I get a Duplicate Globalkey error. I've attached the minimal reproduction code (The ...
0
votes
0
answers
51
views
How to initialize Isar using riverpod?
I use IsarDb as local db. I follow a method. But its sometime not initialize. please check my code. and provide a better solution or inform me where is issue. Some time it shows
Isar not initialized.
...
0
votes
0
answers
27
views
How to use firebase_auth_mocks with firebase_ui_auth to mock the sign in to a flutter app during integration testing
I am trying to use the firebase_auth_mocks package along with firebase_ui_auth, Riverpod, and patrol_finders to perform integration testing. To learn how to do this, I have created a minimal app with ...
0
votes
2
answers
47
views
How to pass Exception in sync riverpod provider?
I have a provider which throws an exception which I want to handle where I read the provider:
@Riverpod(dependencies: [firebaseAuth])
User currentUser(CurrentUserRef ref) {
final user = ref.watch(...
0
votes
0
answers
67
views
How to implement this type of Multi Dependent Dropdown using ValueNotifiers and FutureProviders from Riverpod 2
I have 3 API calls made using Riverpod Future Provider and family modifier in last two: getAllCategoriesProvider, getSubCategoriesByCategoryIdProvider, getBrandsBySubCategoryIdProvider
My current code ...
0
votes
1
answer
71
views
Is it okay to make a nested ConsumerStatefulWidget? [closed]
Is it okay to make a nested ConsumerStatefulWidget in a single screen? Each ConsumerStatefulWidget has ref.watch(someAsyncNotifierProvider) in it.
1
vote
0
answers
76
views
How do I read a Riverpod provider within a Class or Stream without Ref or context?
I have a Class I use for backend, within which I have a Stream that Streams data from Firebase, as shown below. I need to access the data from a Riverpod Provider to specify the Firebase collection ...
0
votes
1
answer
76
views
How to setup the state management architecture for current use case? [closed]
In my flutter application, I'll be having multiple pages.
Consider 2 pages for now. Both these pages have some filters that are common and can be modified from either page. Both these pages also have ...
0
votes
1
answer
37
views
Flutter Riverpod 2.5.1 not updating StateNotifier value on read
I have a flutter app and I want to use flutter_riverpod as a global state manager. The problem is that I cant access my variable even when i use the read method. What am I doing wrong?
My Screen code:
...
0
votes
1
answer
102
views
How to properly initialize a StateProvider with an initial value in a screen using Riverpod in Flutter?
What I'm trying to understand is the best way to initialize a provider using the parameters passed to the widget. Specifically, I need to set the initial state of a FilterProvider based on the value ...
0
votes
0
answers
23
views
How to update a dynamic riverpod UI after configuration changed?
How to update a dynamic riverpod UI after configuration changed?
It feels like bad style to tie the viewmodels to a specific configuration backend which may change in the future. So there should ...
1
vote
1
answer
71
views
cant go to the next screen with context.go of go_router when using asyncnotifier to call an api and store value in the DB
I am using an asyncnotifier to run background task of configuration and would like to use a loading screen which will get dismissed and go tho the next screen once the async is done.
Here is my code :
...
0
votes
0
answers
55
views
Flutter: Item is added only when button is pressed twice or more (Riverpod Inventory management)
I have an app that has an inventory of Items and I followed very similar approach to delete, add, update items methods; but add button is only working when pressed twice. If I press it 4 times, same ...
0
votes
0
answers
89
views
integrating shared_preferences into riverpod
I am looking to use shared_preferences with riverpod. I'm a riverpod novice and have never worked with shared_preferences before, so I was looking for a guide on/example of how to combine the two. I ...
0
votes
0
answers
55
views
Flutter all widgets are rebuilding on keyboard open or close
The app looks like this:
ProviderScope(
child: MaterialApp.router(
I have a bottom nav and the next flow:
Bottom nav at index 0 has a widget A
Widget A has a list and tapping on a list item opens ...
1
vote
1
answer
75
views
I don't know how to mock Riverpod's Provider with mockito
I am writing a test in Flutter using mockito, I want to mock Riverpod's Provider, but I get an error and can't solve it.
The various versions are as follows
# pubspec.yaml
environment:
sdk: ^3.5.2
...
2
votes
1
answer
41
views
Flutter Riverpod Image is not removing from UI
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:image_picker/...
0
votes
0
answers
68
views
Riverpod: Integrating a Single Endpoint Across Multiple Stepper Screens in Flutter + Riverpod
Question:
I'm building a Flutter application with a stepper wizard, consisting of 4-5 separate screens (each in its own file). Each screen contains various form fields (text fields, dropdowns, date ...
0
votes
1
answer
67
views
Flutter App hangs at build: Loading a Json Asset and Using Riverpod
I will try to be brief and only add relevant pieces of code.
This is the screen that tries to load Item objects from a JSON:
Widget _buildItemList(List<Item> currentItemList) {
return ListView....
1
vote
1
answer
45
views
How to change `HintText` and `Border` color to red on error for both Username and Password fields in Flutter?
Question:
I want the hintText and border color of both the username and password fields to turn red when there's an error. However, only the password field is working correctly, while the username ...
0
votes
1
answer
57
views
Dart Riverpod merging two providers of the same type
I am looking for a way to combine two providers (that both emit the same type of values) into one such that the resulting provider emits the most recent value emitted by either of the two input ...
0
votes
1
answer
40
views
Showing a list of posts in Flutter
I have a social media app which like any other social media apps shows a list of posts which is vertically scrollable. So the problem is that it the functionality isn't working as expected and I don't ...
1
vote
1
answer
109
views
Flutter Riverpod Streamprovider with Firebase Document Listener
I have written a riverpod stream provider in flutter, which should wait after successful authentication of the user until the user document exists. if this exists, the document should be read out and ...
2
votes
2
answers
283
views
How to access the route data outside the StatefulNavigationShell with GoRouter in Flutter?
First of all, thank you very much for helping me with this challenge !
What I Try To Achieve
My Flutter Desktop app is splitted between a Navigation side bar, and a content area. Only the content area ...
-2
votes
2
answers
71
views
Is riverpod the best way to display/collect input from multiple textformfields on multiple tabs? [closed]
Given the following page with 3 tabs that all contain multiple textfields, is using the riverpod library the best/easiest way to both set and collect values from each tab's textformfield widgets?
The ...
-1
votes
1
answer
131
views
Riverpod 2.5 and Firebase
I'm currently working with Riverpod 2.5 and Google Sign-In, and I'm trying to figure out how to integrate Riverpod with it. Riverpod 2.5 recommends not using StateProvider and ChangeNotifier. ...
1
vote
0
answers
18
views
Read Firebase data as soon as available Flutter [duplicate]
I have tried to implement a login system with riverpod and firebase in flutter.
This should be implemented in such a way that as soon as the login state of Firebase changes, all user data should be ...
0
votes
0
answers
121
views
How to Maintain Rounded Corners with Full Background Color in Flutter Sidebar?
Question:
I'm working on a Flutter Windows app and trying to achieve a sidebar design with rounded corners and a full background color. However, I'm having trouble maintaining the rounded corners when ...
0
votes
1
answer
44
views
My code is losing state when I switch from one screen to another in flutter app
I have a flutter app where a new user is taken to the user profile screen. Here they can enter more information and save the data.
Just before the save method, I put all the data into a riverpod ...
0
votes
1
answer
52
views
How to execute member method in FamilyAsyncNotifier of riverpod?
How to execute member method in FamilyAsyncNotifier?
(This is kind of continuous question to my previous question.)
I initialized my FamilyAsyncNotifier by passing parameter to it. However, now I am ...
1
vote
2
answers
292
views
Passing parameter to AsyncNotifier of Riverpod in Flutter
I would like to initialize an AsyncNotifier with parameter. I have looked at a couple answers on SO but I have not been able to find one for my case. (This might work if I used annotation approach but ...
2
votes
0
answers
50
views
flutter jumps back to the last route
I want to build a loading screen for my flutter app, which includes a small start animation.
The goal is that the loading screen is only left when a 4 second timer has expired and the data is loaded.
...
0
votes
0
answers
139
views
Flutter: 'build_runner' not generating the '.g.dart' file
running 'dart run build_runner watch' isn't generating 'g.dart' file
Here is the code - annotation provided, 'part' added - name of the file is correct.
Dependencies are added correctly.
When i run ...
0
votes
1
answer
59
views
How do I unit test for controller initial state when AsyncData is a List<Object>
I have a test testing for the initial state of a controller. It keeps failing saying no matching calls, but my other controller tests using the same code are fine (the difference is they have an ...
1
vote
1
answer
94
views
AsyncValue.guard results with AsyncLoading
I have a riverpod provider which stuck in the AsyncLoading state for weird reason. Should be AsyncData after AsyncValue.guard, but stays in AsyncLoading state indefinitely
@riverpod
class ...
0
votes
1
answer
53
views
Read state of provider without passing arguments again
Let me preface this that I'm very new to Flutter and coming from Rails where current_user was much simpler to setup. I'm creating a functional currentUserProvider:
@riverpod
User currentUser(...
0
votes
1
answer
52
views
obtain response after making request in user interaction
When a button is pressed, I'm displaying a message in the SnackBar when sending the request. I'd like to also display the response once it arrives. I've played for a while, and I expected ref.read(...
0
votes
0
answers
126
views
Proper way of implementing Auth Guard in Flutter App with auto_route
Well, in my application it uses riverpod and autoroute and unfortunately I have a problem with guard here. I would like my app to display DashboardPage if isAuthenticated == true and WelcomePage ...
-1
votes
1
answer
43
views
Calling api call using riverpod onClick Listener in flutter
I'm trying to call the same api call using dio and listen to that api call using riverpod , but the issue is that when i call the api call in the build function , it works but when i call the same api ...
0
votes
1
answer
105
views
How to reset the state of FutureProvider in Riverpod
Problem description:
When the user enters the page, loading is displayed, and then the network request is automatically executed.
If the request is successful, the relevant data is displayed.
If the ...