Questions tagged [statefulwidget]
339 questions
1
vote
3 answers
why state class of StatefulWidget should be private in flutter
As I learned that state of StatefulWidget widget in flutter defined as private and both of snippet of VS Code , and android studio do this like below on _RectAnsState
class RectAns extends StatefulWidget {
final String title;
const…

freeman3020
- 23
- 6
1
vote
1 answer
How to append Slider under the text within button when i press the raised Button?
Immediately after my app start it will show a button.
As soon as this button is pressed I want to build a slider within the same button to control the volume for this sound.
All I need is to make this slider appear and not the mechanics to control…

ARUN BALAJI
- 127
- 1
- 15
1
vote
1 answer
Why setState in parent StatefulWidget do not update child StatefulWidget
I know, that correct way to update child StatefulWidget from parent StatefulWidget is to use child GlobalKey instance.
But i cant understand, why setState(() {}) not doing the same! I didnt found any documentation or explanation about this.
From…

Рома Богдан
- 569
- 9
- 10
1
vote
0 answers
Flutter: Strange animation combining bottomSheet and bottomNavigationBar and calling setState
Im having a Scaffold with a bottomSheet and a bottomNavigationBar in a stateful widget.
Within the bottomSheet, i plan to add buttons, calling setState and triggering a rebuild of the local widget tree.
The problem is, that there is a strange…

BorisBaroslav
- 206
- 1
- 6
1
vote
1 answer
Flutter - The method '|' was called on null. After hot reload it is working
I am pretty new in flutter. I don't know what happening in background because after hot reload its work fine. On another dart files that happens, firebase dont provide me data on initialization just after hot reload.
class CityServices {
…

Prahaan
- 13
- 5
1
vote
1 answer
How to do I get a parameter from a stateful widget
How do I get access to the _selectedCurrency parameter which inside the following stateful class from another stateful class?
import 'dart:io' show Platform;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import…

MKapp
- 373
- 7
- 24
1
vote
1 answer
Flutter: Better way to use ObjectKeys?
I am using a StatefulWidget whose constructor contains an Object, like
class X extends StatefulWidget {
X({this.o});
Object o;
...
}
As it sometimes happens, this object o changes, but the widget X does not update, so I had to add an ObjectKey…

König Wey
- 151
- 1
- 7
1
vote
1 answer
Flutter: Stateful Widget does not update
Imagine two Widgets: Main that manages a tabbar and therefore holds several Widgets - and Dashboard.
On Main Constructor I create a first Instance of Dashboard and the other tabbar Widgets with some dummy data (they are getting fetched in the…

CAoT
- 183
- 2
- 10
1
vote
0 answers
Flutter StatefulWidget wont update
So I have a Widget and inside the build method:
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraint) {
return Container(
child: GestureDetector(
behavior:…

Quasi
- 576
- 4
- 13
1
vote
3 answers
How to access passed value in the Statefulwidget?
I am passing an String from another StatefulWidget to the below CardItem StatefulWidget and then from here the String is passed to the _CardItemState as shown in the code below.
But how this String passed should be accessed from…
user13615795
1
vote
0 answers
Reason for changing Flutter stateful widget's final widget variable while state variable doesn't
Consider the following code snippet:
class CustomStateFulWidget extends StatefulWidget {
final GlobalKey navigatorKeyFinal = GlobalKey();
@override
_CustomStateFulWidget createState() => _CustomStateFulWidget();
}
class…

Md Golam Rahman Tushar
- 2,175
- 1
- 14
- 29
1
vote
1 answer
Why does a child state of StatefulWidget doesn't get reset when constructor parameter changes?
I have a custom widget class:
class FancyButton extends StatefulWidget
{
final Function() onTap;
final String text;
final IconData icon;
bool enabled;
FancyButton({this.onTap, this.text, this.icon, this.enabled = true})
@override
…

Gintas_
- 4,940
- 12
- 44
- 87
1
vote
3 answers
Can I use RefreshIndicator in Stateless flutter widget?
I'm fetching some json data from the internet and displaying in a listview builder inside a stateless widget
Now I want to refresh the data using RefreshIndicator.
Do I need a stateful widget for this or can I manage to do this with a stateless…

user730376
- 33
- 4
1
vote
1 answer
setState() is not updating value in flutter
Problem: As per the other solutions I found, I initialized my variable outside the build function but setState() still doesn't update my value.
Here, I am trying to update the value of ldn(left-dice-number) to 6 from 1 when ever it senses a touch.…

karan bhandari
- 11
- 2
1
vote
1 answer
How to perform signOut on sidenavbar using switch statement in flutter?
I am new to flutter and I am trying to perform signOut() function on sidenavbar. I got stuck in a code segment. After a couple of attempts, I got errors like:
type Future is not a subtype of type Widget
I have the following code. How should I call…

STBox
- 583
- 8
- 23