Questions tagged [flutter-state]

369 questions
0
votes
2 answers

Does MVVM require to remove all logic from the Widgets?

I'm having confusion regarding the correct implementation of MVVM architecture in a flutter. Does MVVM require separating just the UI calls from the UI or separating the complete logic of the widgets, even if it is to update a CheckBox? If using…
ASAD HAMEED
  • 2,296
  • 1
  • 20
  • 36
0
votes
1 answer

Null check operator used on a null value, Flutter, State, LateInitializationError

A simple app which returns a TextButton() with given name and given color. Problem: I have to choose the color first and then name the card but can't name the card and then choose the color. I'd get an LateinitializationError with late String…
Val
  • 31
  • 1
  • 7
0
votes
1 answer

Flutter initialization LateInitializationError

(https://github.com/panval/cards.git "Link to my github") Newbie here. Newbie to code actually. Error: LateInitializationError: Local 'newMyCardTitle' has not been initialized. Please look at the code on my github or get from version control. App…
Val
  • 31
  • 1
  • 7
0
votes
1 answer

showDialog in initState after invokeMethod from java code

I want to show a dialog in whole app when a intent is triggered. For this, I add onNewIntent listener in android and invoke a flutter method: @Override protected void onNewIntent(Intent intent) { if…
0
votes
0 answers

How to call graphql query X number of times with different variable values in flutter?

I am using graphql_flutter: ^5.1.0 from pub.dev. Its very easy and helpful. I am able to make queries and mutations easily in it. The only problem is now I am in a situation where I am supposed to call a search query again and again everytime the…
Cassius
  • 353
  • 3
  • 16
0
votes
1 answer

Flutter Bad State: no element - list of objects from map not working

My screen is shown within a FutureBuilder and takes in a usersMap and a postsMapsList. I have a function that's called in initState which takes all the users and post out of those maps and turns them into lists of custom objects. In a widget I have…
Globe
  • 514
  • 3
  • 17
0
votes
0 answers

How To I change Flutter bloc state

I am using bloc in my project but when I emit 2 or 3 times the same state my state does not change on((event, emit) async { var model = await _offlineRepository.getPeriods(event.id, event.date); final state2 = state as…
0
votes
0 answers

Why is StateNotifier stream with listeners not working - Flutter

I have 2 screens in my TabBarView that use the same data so instead of fetching it for each screen, I decided to make a shared data class with a StateNotifier to update both screens when the data is loaded. That looks like this: class…
Globe
  • 514
  • 3
  • 17
0
votes
1 answer

Flutter - Provider, State and Sqflite - the right way?

Consider simple scenario, where there are 2 domain classes Parent and Child, and an AppState. All is stored in SqfLite. class Parent extends ChangeNotifier { int id; String name; List children; } class Child extends ChangeNotifier { …
Maciej Pszczolinski
  • 1,623
  • 1
  • 19
  • 38
0
votes
1 answer

Flutter selected product becomes unselected after switching pages

I am building an online bottle store app using flutter and I am having an issue where if I add a product to favorites the selected product's button won't stay selected on the home page if I switch pages. I have categorized the products using a…
0
votes
1 answer

Flutter: Need to load values and then make a firebase query for Futurebuilder caused RangeError (index)

I'm trying to load the geo location first. Then I use this value to start a query which events are in a certain radius from this location. I want to display these events in a FutureBuilder. My problem: I have to initialize Future futureEvents…
0
votes
2 answers

Why Provider.of<> doesn't work without `listen: false`?

I've simple widget tree, and try to figure out why Provider.of<>() doesn't work in the GestureDetector, onTap() callback. This is my model: class ShareObject { int intField; ShareObject(this.intField); } class ShareObjectProvider extends…
wapn
  • 359
  • 1
  • 7
  • 19
0
votes
2 answers

Is it possible to process State data before a Widget is disposed?

The Problem I have a Widget that I reuse in my app, say the default "you have pressed the button this many times" Widget. I have added an asynchronous saveData function to this Widget, which takes the int in the State and stores it (say in the…
fravolt
  • 2,565
  • 1
  • 4
  • 19
0
votes
1 answer

Managing routing and state from a central place in flutter

I have this simple flutter app that consists of just two pages linked with the router which is defined in the main() function. However, i would like to isolate my classes into their own files since my app consists of many pages. Here is my…
Gandalf
  • 1
  • 29
  • 94
  • 165
0
votes
1 answer

Flutter change AppBottomNavigation body by tapping on button on another state

I have an AppBottomNavigation for five different states. In the first state, HomeScreen, I have a button. By tapping on this button, the state is to be changed to the third element of the AppBottomNavigation.How exactly can I implement this? I have…
Jeremy Brehe
  • 117
  • 1
  • 12