Questions tagged [statefulwidget]
339 questions
1
vote
0 answers
Flutter. How to correctly update state of nested widgets?
I'm new in flutter and I'm trying to implement something like radio group with custom buttons in Android. For this I created StatefulWidget, which hold list of selectable buttons. For every button I was set press listener where I do something like…

testivanivan
- 967
- 13
- 36
1
vote
1 answer
Getting error when accessing 'widget' in state class in flutter
Currently working in a project where I am facing a weird error that is using 'widget' to get stateful class property showing error. Here is my StatefulWidget class where I am trying to use controller, title, labelText using widget but can't access,…

Shariif Islam
- 259
- 1
- 2
- 15
1
vote
0 answers
StreamBuilder on FireStore Document is refreshing widgets for which data is not changed
So I have a list of orders, which I am pulling from FireStore and showing on a page. Only the status part of the order is where I have used StreamBuilder to fetch the real time status. So the StreamBuilder is on a document:
FirebaseFirestore…

Abhideep Chakravarty
- 11
- 2
1
vote
1 answer
Child Property in Stateful Widget
I've made some test widgets to illustrate a point that I'm having difficulty with in a much more complicated widget.
I have the following widget:
class TestListWidget extends StatefulWidget {
Widget child;
TestListWidget({Widget child}) {
…

Hans Donkersloot
- 123
- 5
1
vote
0 answers
Guarantee globalkey in super constructor
I have a StatefulWidget InfoWidget and I want to make sure it always has a key. I'm not able to provide a default value because it has to be constant. When I try to create a GlobalKey in the super constructor call I get a lot of [ERROR] { exception:…

user16909654
- 21
- 2
1
vote
0 answers
Is that necessary to set null for any class instance in dispose() of state class in flutter to avoid holding that class instance in memory?
I am having a class instance(SampleData data) as field in the state class of my widget(SecondRoute). The class instance holds in memory while inspecting using the memory profiler. Is that necessary to set null for the instance in dispose() of state…

Kanagambigai Murugan
- 90
- 7
1
vote
0 answers
[Flutter][AnimatedList] after "insertItem" the new element added to the list does not call "initState" but only "build"
I am using animated list to show a real time notification history on my app. I use subscriptions to open a web socket and get updates realtime.
This is the widget that contains the list
void initState() {
super.initState();
_notifications =…

g.imtech
- 81
- 6
1
vote
0 answers
Maintain state between rebuilds
I have a StatefulWidget which is built from a list of fields.
It looks something like this:
class MultiFieldForm extends StatefulWidget {
/// constructor
const MultiFieldForm(this.fields);
/// Fields
final List fields;
@override
…

Wheat Wizard
- 3,982
- 14
- 34
1
vote
1 answer
Is that possible to use the passing data form another page in Statefulwidget without using "widget."
Hi guy I kind of new to this tool and I'd like some of your help. Let's me explain what tying to do, I'm have a Nav() Statefulwidget that passing bool form a another page to check that now the person that using the app is "User" or "Guest" and in…

Johnny Megg
- 13
- 2
1
vote
3 answers
How to click the button in flutter to change the background image
I am a beginner in flutter, I don’t understand the concept of Widget very well.
I want to set the background image as an unsplash random image, but I want to add a button to request a random image again when I click it, but I am confused about many…

Marshall
- 47
- 5
1
vote
0 answers
flutter I/flutter ( 4140): type '_InternalLinkedHashMap' is not a subtype of type 'Map'
late File jsonFile;
late Directory dir;
String fileName = "myJSONfile.json";
bool fileExists = false;
Map fileContent = {};
//late Map fileContent;
//late Map fileContent = {};
//var…

Toska 003
- 25
- 4
1
vote
1 answer
Flutter SqlBrite not rebuilding streambuilder list
I am trying to build a chat storage system with firebase, sqlite and sqlBrite.
The aim of this is to stream the newmessages without having to rebuild the page. The stream from sqlBrite is only rebuilding on setstate eg.when the keyboard is drawn…

Philip
- 11
- 3
1
vote
0 answers
Flutter Unable to update List
Please help - and be patient i am still learning - I have a model with constant data (until I implement my API) that provides Order data
class Orders {
static const List columns = [
"ID",
"Items",
"Total",
"Status",
];
…

Stephen Venter
- 21
- 4
1
vote
2 answers
use getx in flutter datatable's datasource instead of stateful widget
I tried to change rowCount dynamically using Getx in flutter's Datatable DataSource, but it didn't change when I surrounded it with obx.
If I check with ever (), the datasource change itself is detected correctly, but the screen is not updated for…

Tatsuhiko Mizuno
- 437
- 6
- 15
1
vote
2 answers
Pass variable from MaterialPageRoute to custom widget
A little bit of background: Flutter noob here, trying to build an Add To Favourites function. The list of items sits in a PHP/MySQL database which I access using http on FirstScreen. When user taps on one of the list items, they get redirected to…

keymistress
- 138
- 9