82 questions
0
votes
0
answers
48
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 ...
1
vote
1
answer
208
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
301
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
2k
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
127
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 ...
0
votes
1
answer
540
views
How to update hook value from another widget - Flutter
I'm facing an issue with a HookWidget and a StatelessWidget in a Flutter app. I'm passing values from both hooks to the stateless widget. The problem I'm encountering is that the value of ...
0
votes
1
answer
363
views
Flutter useEffect with Key notices value change only once
I've written a code like below and expected the value on screen to never change from "value by useEffect".
*Since every time the button is pressed and the text is changed to "value by ...
1
vote
1
answer
680
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(...
0
votes
1
answer
482
views
Flutter Hook useState not working with dropdown
After choosing a value from dropdown, the value in useState does not update.
This is my model class
class Data {
final int id;
final String name;
final String someOtherData;
Data({
...
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
447
views
Why is the order of flutter_hooks cleanup different than React hooks cleanup?
I'm studying Flutter hooks. I have written a program that is supposed to exhibit the same behavior as Flutter and React hooks. However, I have noticed that the timing of cleanup execution in ...
1
vote
1
answer
879
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(
...
0
votes
1
answer
360
views
Flutter useEffect not updating new values retrieved from LayoutBuilder
I have a function to set the values to the state.
void Function() setSize({double? min, double? max}) {
final currentState = controller?._controllerState;
final newState = currentState?.copyWith(
...
0
votes
1
answer
456
views
How to use Flutter State Restoration with HookWidget
I want to use Flutter State Restoration in my Flutter app. I want to save/restore some data and on internet all articles suggest to use RestorationMixin for this. How can I use RestorationMixin with ...