Questions tagged [flutter-change-notifier]

189 questions
0
votes
1 answer

Recreate ChangeNotifier Instance when page is closed

I'm creating a page that displays some data from a ChangeNotifier, when I close the page (by clicking on back button) and go forward again, the data from ChangeNotifier remains the same (used in a Text). Is a ChangeNotifier a singleton? Can I make a…
0
votes
0 answers

How to access data from the toggle buttons saved through provider

I am saving toggle button data and adding the toggle button data list through provider in the list of Flatdetail1. the code is class FormDetail1 extends StatefulWidget { const FormDetail1({Key? key, required this.onNext}) : super(key: key); …
0
votes
1 answer

Open dialog box in Flutter Stateless widget using ChangeNotifierProvider

I have a Stateless flutter widget which shows a list of TODOs. The list is shown using a ChangeNotifierProvider (of TodoList object, which contains a list of todos). Now when I load the page, I want to show a dialog box asking user to enter a new…
shahalpk
  • 3,383
  • 7
  • 36
  • 55
0
votes
1 answer

Error: Could not find the correct Provider above this AddRecipe Widget

`I want to access the provider in the AddRecipe page in order to save a new recipe and notify the listeners, in my case the list.builder in UserRecipes to rebuild. Sorry for the big amount of code, I added everything that I thought may be useful. I…
Dutzun
  • 13
  • 2
0
votes
2 answers

How to notify a stream to update in Flutter

I am trying to implement pagination in my Flutter app but this is the first time I have done it. My idea was to create a Stream of data that updates each time the user reaches the bottom of a list. I have failed to get this working. My current code…
Globe
  • 169
  • 11
0
votes
0 answers

How to use multi select and setState in flutter?

I want to take multiple values from a dropdown field so i use multi select but i also use setState throughout the app. The thing is that values selected on seState get lost and thats a problem because i cant put more filters on my filtering in the…
0
votes
0 answers

Widget is not rebuilding with Provider context.watch

I created a class LoginStore extending ChangeNotifier to state manage my application and i'm using Provider for dependency injection. According to the documentation, invoking context.watch() is enough to make the Widget listen for changes in the…
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…
0
votes
0 answers

Better way to handle Future with ChangeNotifier in Flutter

I have an object model in my app which needs to be accessed on different pages. I get the object model via a REST interface and store it in a variable (here simplified SomeObjectModel). Since the object model can change through various events, I…
0
votes
1 answer

Flutter Provider Listen:false is not working

I am learning about provider package in which I created an app in which whatever I type in the TextField will change the title in the appbar and a text Widget below TextField. but it was not working so I started trying different codes and after some…
0
votes
1 answer

How to make the initial state in Flutter immutable

I want to write a small board game in Flutter. I have the initial state of the levels. In short, the Level class includes the Board class, which includes many tiles with coordinates. Example below: const levels = [ Level( number: 1, board:…
0
votes
1 answer

Init values in class extending ChangeNotifier

I am new to Flutter, and I have been trying to make a very basic example: changing the theme at runtime from dark to light. So far so good, it works using ChangeNotifier, but now I'd like to initialize my _isDarkMode variable at startup, by using…
senseiwa
  • 2,369
  • 3
  • 24
  • 47
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…
0
votes
1 answer

How use ChangeNotifier and Consumer in custom flutter app bar?

I'm using MultiProvider in my home page on flutter app and work done. But I have a custom App bar which contain a ChangeNotifierProvider with a consumer and not working. AppBar widget are not notify when notifyListener() function called. home…
0
votes
0 answers

How to change AppBar's automaticallyImplyLeading property via a Consumer

As someone new to Flutter/Dart, I have a simplistic proof-of-concept web app (code provided below) where I've genuinely put the effort in to reading & prototyping but cannot quite get the code finished. The app is a test of named routes. FirstScreen…
Gaz
  • 328
  • 3
  • 15