Questions tagged [flutter-change-notifier]
189 questions
1
vote
1 answer
Refresh page if data isn't shown on screen
I have a Future in my initState function that gets jwt from cache and uses it to get the logged in user's details. The initState function is:
@override
void initState() {
super.initState();
Future.delayed(Duration.zero, () async {
…

rawm
- 251
- 5
- 24
1
vote
1 answer
How do I keep a instantiated variable unchanged after using Provider.of
I have a page where I can choose a user theme color that is used as colors in my app. I have it set up so a modal bottom sheet pops up with the color options and then sets it using Provider so when the navigation is popped the new color can be seen…

steve
- 797
- 1
- 9
- 27
1
vote
1 answer
ChangeNotifierProxyProvider update parameter is nullable
I have a MultiProvider with a list of one ChangeNotifierProvider for AuthProvider (this a class with NotifierProvider) and a ChangeNotifierProxyProvider for .
As you can see, in the update closure of the…

pedrozopayares
- 2,856
- 1
- 13
- 14
1
vote
1 answer
When does dispose() get called on a ChangeNotifier?
My question stems from the Flutter Documentation on simple state management,
... Note that we’re defining a builder that creates a new instance of CartModel. ChangeNotifierProvider is smart enough not to rebuild CartModel unless absolutely…

pakmanz
- 11
- 1
1
vote
2 answers
Flutter error: Null check operator used on a null value - ChangeNotifierProxyProvider issue
I am new to Flutter and this is my first time using ChangeNotifierProxyProvider following YouTube tutorial. I did the exact way it was done but I got this error in vs code.
Is there anything I missed or I am doing it wrong. Please help me solve this…

atigdawgahb
- 41
- 1
- 5
1
vote
1 answer
Operator can't be unconditionally invoked because the receiver can be null
I'm trying to add shopping functions to my app. I'm attempting to use ChangeNotifier to add a cart item counter and I am getting the error message 'error: The operator '-' can't be unconditionally invoked because the receiver can be 'null'. I'm…

Carleton Y
- 289
- 5
- 17
1
vote
0 answers
flutter consumer not rebuilding widget
consumer widget is not called after data is updated in provider of ChangeNotifier class in release mode, the same code is working fine in debug mode, and first time in release mode but if the screen is called with pushReplacement it's not rebuild…

Ashok Jangid
- 11
- 1
1
vote
1 answer
Change Notifier Provider to add widget to Favourite Screen
I've made screen with details of movies and with favourite movies. Also I've got a list of movies. In Detail Screen, there is favourite icon. I want to make that when you tap on this Icon, I want to add this movie to Favourite Screen.
There is a…

ArQczeg14
- 69
- 1
- 10
1
vote
1 answer
RouterDelegate won't rebuild upon changes from listener Flutter
I'm trying to switch to Navigator 2.0 following the example at https://github.com/carloshwa/flutter-example/tree/navigator_2 adapting it to my code.
As in the example, I have a class AppState extends ChangeNotifier which RouterDelegate listens…

Vincenzo
- 5,304
- 5
- 38
- 96
1
vote
1 answer
Why does notifyListeners() not update consumer?
In my app built with Flutter, I am using the provider package to add state management to my app. Additionally, I am using the shared preferences package to keep track of the login state of my user (token based). The app consumes a Laravel API that…

Eric Landheer
- 2,033
- 1
- 11
- 25
1
vote
1 answer
How to implement provider, specifically ChangeNotifierProvider implementation in my Note app
I am learning provider and wanted to implement that in my simple note app. I went through the docs, saw youtube videos and Medium articles about provider implementation, I understood the concept(I think) but I am still a little confused on how to…

ghost deathrider
- 151
- 16
1
vote
2 answers
notifyListeners() does not return data to UI
I am new to flutter and need some help please
I have this screen with GoogleMaps (simplified for here):
class OrderDetailsScreen1 extends StatefulWidget {
const OrderDetailsScreen1({
Key? key,
}) : super(key: key);
@override
…

TonyWyomy
- 570
- 5
- 17
1
vote
1 answer
Widget not redrawing on Provider variable change - Flutter
I have a provider called "FavoritesProvider" which has a variable called "_favoritos" where I store a list of id's.
What I am trying to do, is redraw a ListView widget every time a new item is added or removed to the favorites variable. Here is the…

MIPB
- 1,770
- 2
- 12
- 21
1
vote
2 answers
How to correctly extend a custom Provider in Flutter
I have a parent ChangeNotifier ParentProvider, and 2 other providers extend the ParentProvider;
ChildProviderA, ChildProviderB.
I have a route which is called MyScreen
class MyScreen extends StatelessWidget {
@override
Widget build(BuildContext…

Ismaeel Sherif
- 555
- 7
- 15
1
vote
3 answers
How reinitialize flutter MultiProvider's all providers data?
In my application, I have many providers, for instance notifications, auth, profile, conversations, trips, etc... And now I need to reinitialize all providers, when user logout. Otherwise old user data will still stay in provider, and new user will…

hmarat
- 43
- 6