All Questions
Tagged with riverpod flutter-hooks
31 questions
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
1
answer
87
views
How to disable skipLoadingOnRefresh with flutter riverpod using switch expression
Lets say i have this simple future riverpod which is
@riverpod
Future<double> balance(BalanceRef ref) async {
await Future.delayed(const Duration(seconds: 5));
return 100;
}
and inside ...
0
votes
1
answer
179
views
Flutter: StateError (Bad state: No ProviderScope found) [duplicate]
i am trying to have both dark and light mode (before my app was just dark).
i used hooks_riverpod: ^2.5.1 to switch between these modes.
when i debug, i found that it throw StateError (Bad state: No ...
0
votes
1
answer
1k
views
I have the error "Cannot use "ref" after the widget was disposed", what's wrong?
I have a loading provider, and whenver I need to do an async work
I set the loading state to true and at the finish time of asynchronous tasks I set it to false
but when I want to do so I get the ...
1
vote
0
answers
95
views
Riverpod stream provider with SignalR
iam trying to implement signalr with riverpod using a stream and this stream will return the live feed parameter , i have tried to make a future provider for the connection and a stream provider for ...
1
vote
1
answer
501
views
Dispose hook on widget rebuild
Do hooks dispose of themselves when a widget rebuilds? Is it possible to cause this behavior?
I'm using Riverpod for state management and I have a widget that creates a custom TextEditingController ...
1
vote
1
answer
1k
views
Call a provider with flutter hooks
I had previously developed a Flutter app using Riverpod(StateNotifierProvider, and everything was working smoothly. Recently, I've been trying to migrate from regular Riverpod to Riverpod Generator(...
6
votes
2
answers
2k
views
Is there a use for hooks_riverpod
I'm kinda confused as to what exactly the aim is with hooks_riverpod, I've used flutter_riverpod, and I've used flutter_hooks, but what is hooks_riverpod, on the pub.dev main page for hooks_riverpod, ...
1
vote
1
answer
686
views
Getting error when trying to add WidgetRef parameter to the build method in Flutter
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(
const ProviderScope(
...
1
vote
2
answers
1k
views
Riverpod with hooks beaks when widget is disposedI
I have Flutter mobile app that is using Riverpod with hooks.
I have the following function that I would like to be called when the widget is disposed:
useEffect(
() {
final ...
0
votes
1
answer
958
views
Riverpod `StreamProvider` stream causes Flutter `TextFormField` to loose cursor entirely on 1st character input despite no stream events emitted
Overview
The issue consists of the Flutter TextFormField loosing its cursor entirely upon the first character being inputted via a keyboard - see full replication steps below.
Note the TextFormField ...
2
votes
1
answer
1k
views
Riverpod : future provider is stuck on loading
Describe the bug
when executing the provider with ref.read or ref.watch the result is the same , it is stuck on the loading block , while testing the api in postman works fine , the funny thing is ...
0
votes
2
answers
495
views
LateInitializationError: Local 'prefs' has not been initialized
I am working with riverpod and flutter_hooks
I am trying to get implement shared_prefrences using this 2 approaches and this is what I get to so far :
pref_changenotifier.dart
import 'package:flutter/...
0
votes
1
answer
953
views
flutter_hooks useState value is being reset to the initial value upon popping the stack
I have this useState:
class RegisterFormPageWidget extends HookConsumerWidget {
const RegisterFormPageWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, ...
0
votes
1
answer
1k
views
Flutter Hooks: Getting error while using useEffect with TextEditingController
I want to use useEffect with TextEditingController instead of useTextEditingController.
Error: late Initialization Error. Am I not writing init and disposing correctly?
class EffectTest extends ...
0
votes
1
answer
603
views
Modifying Lists inside of classes - Flutter, Riverpod, Hooks
I would like to have a class that contains a list of another class and be able to update it using Riverpod/Hooks. I'm trying to figure out the best syntax or even way to approach the issue.
I'm ...
4
votes
0
answers
2k
views
How to add initial value to TextEditingController with flutter_hooks and riverpod
If I want to add initial value to TextEditingController from Riverpod's provider with hooks, how can I do it?
can I use ref.read(someprovider) inside of useTextEditingController like this?
final ...
0
votes
1
answer
146
views
FLUTTER - How to properly upgrade this code to work with RiverPod 1.0+?
I added the libraries to pubspec.yaml. In the current project I am not using hooks, but used the package because I want to use this to build a skeleton starter project.
pubspec.yaml:
flutter_hooks:...
2
votes
2
answers
662
views
looking up a deactivated widget's ancestor is unsafe => using Riverpod => using "Navigator.of(context).pushReplacementNamed('/page');"
The scenario which I did and caused this Error: 1. after Login page created when I used hot-reload button 2. when I pressed Login-button and state of the page changed.
Recently I decided to use ...
2
votes
0
answers
4k
views
How to refresh Riverpod FutureProvider using FlutterHooks useEffect
I am developing mobile application with flutter using flutter hooks.
I want to refresh Riverpod FuttureProvider using useEffect,
but it doesn't work nicely...
My code is
@hwidget
Widget someWidget(...
1
vote
1
answer
442
views
Where/When to perform operations such as sorting, grouping with a StateNotifier controller?
I am wondering when/where to perform operations after HTTP request done with a RESTFUL API.
I am using a StateNotifdier as a mean of Controller to perform simple CRUD operations such as retrieveItems, ...
0
votes
1
answer
2k
views
Is HookConsumerWidget still a part of hooks_riverpod.dart?
I am working on building some of the example hooks_riverpod applications and I get an error that the HookConsumerWidget is not a dart class. Is this still a valid widget in the latest version or has ...
1
vote
1
answer
1k
views
StateNotifierProvider not updating state using HookWidget
I am trying to use Riverpod state management. I have two TextFormField and I want to set the value of a Text by taking the sum of the values entered in each of the fields using a StateNotifierProvider....
3
votes
2
answers
5k
views
Riverpod ProviderListener - 'StateNotifierProvider<Auth, bool>' can't be assigned to 'ProviderBase<Object, StateController<bool>>'
I'm trying to use a ProviderListener from Riverpod to listen to my authProvider and control the page displayed if a user is authorized or not. I'm getting the error:
error: The argument type '...
0
votes
1
answer
1k
views
Access Providers from Dialogs for Flutter hooks
I am new to Flutter hooks and riverpod
Basically I have a provider that stores the list of books in a book shelf.
class BookList extends StateNotifier<List<BookModel>> {
BookList() : ...
2
votes
1
answer
3k
views
Flutter Hooks Riverpod not updating widget despite provider being refreshed
I've been studying flutter for a couple of months and I am now experimenting with Hooks and Riverpod which would be very important so some results can be cached by the provider and reused and only ...
19
votes
6
answers
21k
views
error `pumpAndSettle timed out` MAYBE due to riverpod
I'm stuck with a widget test and I could use some help
to reproduce the behavior please run the code sample below
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod....
1
vote
1
answer
1k
views
Read riverpod stream value in useEffect
I want to read the first value from a list stream in useEffect to select the first value in the list returned. How do I do this differently.
Shows an error on restart.
I am using hooks_riverpod
...
2
votes
1
answer
2k
views
Riverpode and Hooks in Flutter, how to implement the StateNotifier for async calls?
I am new to Flutter and recently I decided to look into providers to be able to reuse some SQLite DB calls I have using FutureBuilder as suggested in this other question.
After reading about it I ...
3
votes
1
answer
5k
views
Riverpods with hooks Flutter - using Provider
Could someone give an example of additional state modifications in Riverpods preferably with riverpod_hooks - I'd like to be able to use it without making an additional widget, so for example:
onPress:...
0
votes
1
answer
7k
views
Initializing riverpod Provider with a custom ChangeNotifier
I'm just trying out the new river_pod, flutter state management library. My goal here is simple. GestureDetector in the main page listens to vertical drags and updates the animation controller ...