Questions tagged [flutter-change-notifier]
189 questions
0
votes
1 answer
Is it necessary to use StateNotifier even if there is only one value and no method?
If there is only one value and no method, do we still need to use StateNotifier as follows? Or is there a simpler mechanism?
Since this value is rewritten and referenced from the outside, the corresponding function must be included in the…

Ganessa
- 782
- 2
- 7
- 24
0
votes
3 answers
If another variable in ChangeNotifier is changed, will the Consumer's model be updated?
If the following setIntVal is called and notifyListeners(); is executed, is the Text redrawn? intVal is changed but strVal is not.
Similarly, what happens when StateNotifier is used?
class DummyManager with ChangeNotifier {
DummyManager();
int…

Ganessa
- 782
- 2
- 7
- 24
0
votes
2 answers
ChangeNotifier changing but widget not updating with gestureDetector
I have this simple changeNotifierProvider
here it is
import 'package:flutter/material.dart';
class CreatePetProvider extends ChangeNotifier {
String? _gender = 'Male';
get gender => _gender;
set changeGender(String gender){
_gender =…

Joaquín Varela
- 329
- 5
- 18
0
votes
1 answer
my ChangeNotifierProvider doesn't work as cant be found correct provider
i have a problem with my ChangeNotifierProvider widget. my proivder cant be found so i cant update my target widget. there is similar errors that was solved but i cant understand the fixes as i am new on ChangeNotifier. So if you interested in help…

kalfalarin_omer
- 75
- 6
0
votes
0 answers
Flutter Canvas Set Frame Rate
I have a custom painter that I'm using to build a small game engine for fun. I have the following code that is supposed to call the draw function of my custom painter 60 times per second:
SceneRenderChangeNotifier repaintNotifer =…

Hans Donkersloot
- 123
- 5
0
votes
0 answers
Why is ChangeNotifier updating endlessly
I have 2 data provider classes that extend ChangeNotifier. Within each, there's a function to fetch data and at the end of them, I use notifyListeners() to notify the screens/listeners that the data changed. However, it seems that the listeners…

Globe
- 514
- 3
- 17
0
votes
1 answer
Transferring a dart setter around in flutter
I am working on creating a signup process with multiple screens. For now I have first name and age screen. I have the following usermodel. The idea is whenever I update one of the field, it triggers rebuild of the signup-screen, so that the next…

watercroc
- 17
- 5
0
votes
1 answer
Flutter Provider ChangeNotifierProxyProvider not being created
I'm using Provider to do some filtering in my application. I'm using a ChangeNotifier for each of my filters. The filters themselves have children, but all updates are going through the ChangeNotifier class.
Here is my code:
MultiProvider(
…

Danoctum
- 321
- 5
- 16
0
votes
1 answer
Provider says the desired variable isn't initialized but it prints from its own class methods
When I try to use provider in another component, it says the value that is to be printed hasn't been initialized yet. But, when sign up function is called, if I were to print the username value of the class it is reflected in the console. How can I…
0
votes
3 answers
how to let consumer listen to multiple parameters in flutter?
I need to let the consumer widget listen to multiple variables depending on a boolean value.
this is the model class
class Lawyer{
Data? data;
double? distance = 0;
Lawyer({this.data, this.distance});
factory…

Ahmed Gamal
- 55
- 1
- 10
0
votes
0 answers
How Can I reset edithing data to pop page? Flutter + ChangeNotifier + Riverpod
I am a Flutter begginer.
I make Trash Day Manage application.it is kind of similler to TODO application.
DB is Hive. State management is RiverPod and CahngeNotifier.
https://github.com/dai10512/trash-out/tree/master
problem is happen in detail…

Daisuke Osanai
- 1
- 1
- 3
0
votes
1 answer
Flutter provider assistance please
I am trying to pass my _myUnit.unit value from this custom widget to my screen that calls the widget to confirm what units a user has selected. Currently I am able to print the correct values when the Icons.loop is pressed but don't have access when…

Peter Moran
- 13
- 5
0
votes
0 answers
Multiple notifyListeners in flutter ChangeNotifier trigger only one build in widget
I have Flutter app with simple Provider and Consumer flow class SomeProvider with ChangeNotifier. My SubscriptionProvider has next methods:
methodA() async {
isLoading = true;
data = {};
notifyListeners();
await…
0
votes
0 answers
What is the best way to use ChangeNotifier provider objects with the build method?
I have a flutter application and I keep getting the error which states:
The following assertion was thrown while dispatching notifications for UserData:
setState() or markNeedsBuild() called during build.
UserData is a class that extends…

steve
- 797
- 1
- 9
- 27
0
votes
1 answer
Implementing ChangeNotifier to StateNotifier
I've rewriten my ChangeNotifier codes to StateNotifier but the problem is that it does not rebuild when you pressed like or dislike the student button in the student row. I expect that ref.watch() listens to state of likedStudentsNotifier and in…

Mustafa Aksoy
- 17
- 4