Questions tagged [changenotifier]
33 questions
1
vote
2 answers
how to use consumer correctly in flutter provider package
This is the error message
: The following NoSuchMethodError was thrown building Consumer(dirty,
: dependencies: [_InheritedProviderScope]):
: The method 'unary-' was called on null.
: Receiver: null
: Tried…

seadhant
- 11
- 2
1
vote
1 answer
Flutter: Update TextFormField text with ChangeNotifier
In a complex scenario I need to update the text of some TextFormFields when a notifyListeners() is sent by a Model extending ChangeNotifier.
The problem is that to change the text of a TextFormField you have to use the setter TextFormField.text…

DPD-
- 412
- 1
- 5
- 15
0
votes
0 answers
How to set data from firebase to the value of a changenotifier in flutter
I'm new to this world of providers and changenotifiers in flutter, so I don't know how to afford this issue.
I have a widget (NuevoAudiolibro) that represents a new audiobook, and I have a list of chapters associated to this audiobook that are…

nurilu jaja
- 5
- 2
0
votes
0 answers
Flutter ValueNotifier notifyListeners twice
I use ValueNotifier in Flutter and use setValue when data changed.
ValueNotifier gameResultMessage = ValueNotifier(null);
//
gameResultMessage.value = gameResultMessage;
setValue source code
set value(T newValue) {
if…

GHH
- 1,713
- 1
- 8
- 21
0
votes
1 answer
Save favorite posts in Local with provider in Flutter
I'm currently trying to use Provider to save articles once user tap on bookmark icon, new articles once tapped should show up on favourite page, I don't understand why it doesn't save anything.
Below my code used.
What do I wrong?
ArticleModel
class…

Pimpi Rimpà
- 75
- 1
- 8
0
votes
1 answer
Provider does not read it
I want to use the _count variable in another widget.
I can't access _count variable with provider
class Hamburger extends StatefulWidget {
const Hamburger({super.key});
@override
State createState() => _HamburgerState();
}
class…

Salih
- 11
- 3
0
votes
0 answers
My ValueNotifier is not Working properly, why?
I have a GestureDetector inside a ListView and a CustomFilter widget in my Scaffold.
When I filter or change me showList in CustomFiter Widget it seems to be updated because I print the correct value from my CustomValueNotifier.
When it comes to my…

fotis xen
- 19
- 1
0
votes
2 answers
Flutter: Prevent ChangeNotifier's notifyListeners from preventing the animation of the sending button whose state depends on the ChangeNotifier?
My actual app is a lot more complex but I have been able to simplify it down to this example which demonstrates the issue.
I have 2 buttons which are supposed to reflect the same data. In this example, I have 2 like (heart) buttons. They can either…

sudoExclaimationExclaimation
- 7,992
- 10
- 47
- 105
0
votes
1 answer
Flutter - ChangeNotifierProvider crash when ListView items are cleared - setstate or markneedsbuild() called during build
I am trying to build my own custom pull to refresh indicator for ListView.
I am using a ChangeNotifier whose offset variable gets updated by the ListView's scroll controller. My custom refresh indicator uses a Consumer to update its UI and also if…

sudoExclaimationExclaimation
- 7,992
- 10
- 47
- 105
0
votes
1 answer
Provider not found when using MapChangeNotifier
While the entire way I'm managing state in my flutter app is probably somewhat nonsensical, so far my use of Providers/ChangeNotifiers/Consumers has at least somewhat worked. However, I'm now stuck with one of them.
In a class of mine, which happens…

Fly
- 810
- 2
- 9
- 28
0
votes
1 answer
My Counter made with ChangeNotifier Provider replicates its value with other Counter Instances
I am creating a counter for a shopping cart. The problem is when the value of one counter changes, it affects all the other counters on the screen. I used ChangeNotifier and I have no idea what I am doing wrong.
This is the Counter Model
import…

thearach
- 27
- 4
0
votes
1 answer
ChangeNotifierProvider isn't listening
I am attempting to share a ChangeNotifierProvider to my main.dart, however the value never gets updated.
How it works
main.dart uses ChangeNotifierProvider to get an instance of the class Location()
main.dart routes to the location_login.dart page…

taco-tuesday
- 56
- 1
- 5
0
votes
1 answer
Flutter Provider updates multiple time when changing route
I use ChangeNotifierProvider of a model, which has a "number" property and a method to set a random value to it. There are 2 routes. In the first one, there is a variable which listens to this property using context.select or context.watch (does not…

Адилет Абираев
- 55
- 5
0
votes
0 answers
How to get class value from flutter provider?
In my main.dart page I use MultiProvider as shown below. I initialise first two provider in main.dart and I initialise UserInfoProvider in user page.
In user page after initState I get data from remote database and I initialise like shown below. But…

NTMS
- 816
- 7
- 22
0
votes
0 answers
Navigation Issue in my flutter Application. Unable to redirect to the required page or screen in flutter
Below code mainform.dart when run individually i.e keeping Dart entrypint: as mainform.dart working fine and redirecting or navigating to the correct page i.e Feed();
mainform.dart
import 'package:sqlite_crud_flutter/detail.dart';
import…

srk2K21
- 11
- 1
- 6