Questions tagged [flutter-state]

369 questions
0
votes
1 answer

What aspects to consider when defining attributes or methods in a stateful widget?

Below is the definition of a Stateful Widget and its associated state. As we can see, color has been defined in YellowBird and can be accessed in _YellowBirdState via the widget object. My question is with respect to this, how do we decide where…
Noor
  • 19,638
  • 38
  • 136
  • 254
0
votes
3 answers

How to setState does work in my flutter code?

https://github.com/kangsudal/performance_tracker/blob/main/lib/main.dart class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @override State createState() => _MyHomePageState(); } class…
강수경
  • 35
  • 6
0
votes
1 answer

How to allow Flutter "nested" state management?

In short, I have three levels of ChangeNotifiers, the top level, intermediary level and bottom level. Naturally, bottom level is dependent on intermediary level and the latter dependent on the top level. My questions are: Is it possible to achieve…
Noor
  • 19,638
  • 38
  • 136
  • 254
0
votes
2 answers

SetState doesn't do its job - Flutter

When my DropdownButton updates the value it contains, it does so with it, the setState updates the highlight text of my button. But the same variable "ms" that is updated inside the button is not sent correctly to "EventiWidget", the first value of…
0
votes
2 answers

How to automatically deactivate the previous button when clicking on another button?

I have 3 buttons. When you press the button, it turns purple. Only one button can be selected (activated). But now when one button is selected and I want to select another button, I need to first click on the same button (the previous one) and then…
Max
  • 1,141
  • 2
  • 11
  • 34
0
votes
1 answer

flutter warning Do not use BuildContexts across async gaps

I'm facing a warning of Do not use BuildContexts across async gaps. Kindly tell me what is meant by this warning and why I'm facing this warning. I couldn't resolve this warning from few days. Please help me on solving this warning. class…
user12790690
0
votes
2 answers

Flutter - ListView's items' row tile not updating on state build

The list doesn't update after an item removed. It only removes the last row. I simplified the code as much as possible since I can't see anything wrong elsewhere. Either this is weird or I was missing something. class ListState extends…
stackunderflow
  • 1,492
  • 1
  • 23
  • 53
0
votes
2 answers

Deleting an item from a ListView from inside the child widget gives an error

I have a list view in my app, I have written some of the code for each item of the list view in the widget containing the list view itself but for the other part I have defined a new child widget. When I try deleting the last element of this list…
Pro
  • 445
  • 4
  • 14
0
votes
2 answers

Flutter build method call

I have a simple widget, using Provider and trying to understand why it will not rebuild. From my understanding (obviously wrong) because my widget is 'watching' postCode on the AddressViewModel, when changing the value as below, my widgets build…
James Hatton
  • 676
  • 2
  • 9
  • 28
0
votes
2 answers

More than 1 valid return types | What is the correct way | Flutter

Usually while writing my applications in Flutter, I like to mention the return types everywhere. This ensures that I do not return the wrong objects and also checks my code while I'm still writing it. Let us say that I'm writing a method inside the…
Divyam Dhadwal
  • 395
  • 3
  • 19
0
votes
1 answer

flutter screen doesn't update using setState and tryParse

I'm trying to build a simple Calculator with flutter. The prototype I've created isn't able the update the Screen, when using a setState and tryParse. I want to show the number a user presses instantly on the screen and when pressing another number,…
laniakea
  • 29
  • 3
0
votes
1 answer

how to update the contact list on UI without using set state() via button pressed or refreshing the page in flutter?

I am creating an app in flutter in which i can select the contacts from phone book , saving them in shared preferences and displaying contact list on main page UI. Every thing is working fine but i have to press the load button each time to show the…
sjDev
  • 41
  • 5
0
votes
1 answer

How to refresh dialog using setState in listener?

I implemented TabBar inside Dialog and I add listener to this TabBar. I am calling setState when tab is changed but nothing is happening. I tried wrapping my Dialog inside StatefulBuilder but it didnt help. Is there a way to do it? In Dialog I am…
0
votes
3 answers

flutter dynamic Checkboxes don't check

Hi im new to Flutter and coding and tried do build my first to do app. I've created a textformfield to add new todos with a button in a container above. By pressing a button, a new todo will appear on the todo Container. I managed to dynamically…
laniakea
  • 29
  • 3
0
votes
1 answer

Stateful widget inside an Provider (ChangeNotifier) widget does not get updated

I have a Stateless-Provider widget along with its ChangeNotifier-model. Inside the Provider, there is a Stateful widget. When notifyListeners is called, all widgets in the stateless widget get updated, except the Stateful one. What am I missing…
beria
  • 153
  • 1
  • 6