Questions tagged [flutter-state]
369 questions
1
vote
2 answers
Getx Storage return null whenever app starts
I have initilized GetStorage() in main() and calling .read() in onReady dunction of GetX Controller but always get null!
Future main() async {
await GetStorage.init();
runApp(const App());
}
class AuthenticationRepository extends…

Taimoor Sikander
- 605
- 1
- 3
- 11
1
vote
1 answer
How to use FormState in Form's parent widget?
To validate the whole Form in flutter, a GloabalKey must be provided. It looks fine when buttons for interaction with the form contained inside of form, but when, for example, form is a child of AlertDialog, the key has to be passed from…

Timur Khr
- 15
- 5
1
vote
1 answer
Custom Widget revising animation in gridview
I have a custom widget that changes color when tapped inside a gridview. When I scroll to the bottom and scroll back up to the top selected widget its animation is reversed.
I'm pretty sure that it has something to do with the widget being disposed…

craig_hero
- 65
- 10
1
vote
1 answer
List of interactive items using nested StateNotifiers
Do you think it's okay to have a list of StateNotifiers inside the State of other StateNotifier?
For example like this:
class ListOfItems extends StateNotifier {
void doSomethingWithList() {
// update state of list -> rebuild…

Igor' Leonidov
- 11
- 2
1
vote
1 answer
Flutter - Is the performance of Stateful and stateless widget similar if we don't use setState?
I'm currently working on a mobile app and i'm implementing a little user first use tutorial.
thus using the showcaseview 2.0.0+1 flutter package.
this package requires to call a callback when a widget is mounted and built.
@override
void…

Badr Erraji
- 141
- 1
- 11
1
vote
3 answers
How to use a Riverpod provider in initState
I use Riverpod as state management in my web app. I am trying to build an AppBar that scrolls automatically to certain parts of a ListView.
I created a ScrollController as a provider for this purpose.
final scrollControllerProvider =…

JAgüero
- 403
- 1
- 4
- 14
1
vote
0 answers
addPostFrameCallback vs scheduleFrameCallback
So, I was wondering, when to use WidgetsBinding.instance.addPostFrameCallback and WidgetsBinding.instance.scheduleFrameCallback for setState, as according to the documentation, the first one doesn't initiate a frame on its own, while if we…

Vishnubly
- 539
- 1
- 8
- 17
1
vote
1 answer
My screen doesn't reflect the changes in my app though the setState method works well
I'm trying to call a StatefulWidget(i.e FirstPage()) within a MaterialApp. I'm pretty much new to flutter and I don't know where I went wrong. According to my knownledge I've used StatefulWidget to tell flutter my screen on that page is going to…

Evo_star
- 38
- 6
1
vote
1 answer
Textfield clear button not updating state
I have a container that's wrapped within a gesture detector and within the container two text-fields which on clicked will show the time selector and date selector widgets consecutively. I added a clear button next to the date field and on tap it…

Rohith Nambiar
- 2,957
- 4
- 17
- 37
1
vote
3 answers
Select and Unselect (other) Buttons when clicked
I have a Grid.View.builder with Buttons inside. I want to be able to select just one Button at a time!
At the moment I can select Buttons but when I select other buttons the previous Button stays selected.
How can I achieve this?
In…

Val
- 31
- 1
- 7
1
vote
0 answers
How to Call a Graphql Query again for every letter entered in autocomplete widget flutter?
I am able to search in a list using autocomplete widget in flutter and display the options to the user. But actually what I am supposed to do is I have to call graphql query everytime as user enters a letter/alphabet in autocomplete widget. I have…

Cassius
- 353
- 3
- 16
1
vote
3 answers
Not able to change the visibility icon to visibility_off icon or vice versa in flutter
Summary
I was building an app in flutter where I was trying to keep 3 functions linked to one build function, so I have a navigation bar to navigate between these 3 functions (containing the layout).
Issue
While developing the 3rd layout which is…

Spsnamta
- 479
- 6
- 11
1
vote
1 answer
How to re-render a Widget based on another widget using riverpod in flutter?
I want to know how can I refresh a table data (which is fetched from an API using a future provider) and re-render the table widget based on dropdown value change.
Following is the Repo file with providers:
import…

Darshan
- 13
- 3
1
vote
1 answer
Correct way to load ListView data source initially
I have a stateful widget whose state builds a ListView. The ListView gets its data from an http API. I am using a Future method called getData to retrieve this data and populate a List<> with it before calling setState.
My question is where…

barry
- 4,037
- 6
- 41
- 68
1
vote
2 answers
Why Stateless widget rebuild on refresh in flutter
I have created a demo,
I have made a stateful home screen where a column containing two containers.
one is stateless made separately...
On scaffold I have placed refresh button to change randomly color but I don't want to make changes to stateless…

Irfan Ganatra
- 967
- 3
- 13