Questions tagged [flutter-state]
369 questions
4
votes
2 answers
Why use BloC or Provider in Flutter when we already have Flutter's built-in setState?
Maybe I don't understand the purpose of BloC or Provider but I'm confused as to why we would ever want to use them instead of using Flutter's built-in state management using the Stateful widget. I've just finished an app and can't remember a point…

boc
- 158
- 3
- 11
4
votes
1 answer
flutter getx, getview with two controllers
I'm a little bit confused with how GetView works. I currently have a page that needs to have at least 2 different controllers. From what I've seen, people mostly use GetView as opposed to Get.find() for better code format, however GetView seems to…

Shanejz
- 78
- 1
- 7
4
votes
1 answer
Managing mutable state in StatefulWidget / State
I'm a bit confused about how to manage state withing a StatefulWidget. The following is a simplified example of a problem I am running into:
I have a StatefulWidget designed to display a list of things. It is constructed with a list that was…

Brian Abreu
- 43
- 3
4
votes
1 answer
Why is AnimatedList not building using list from bloc state in flutter?
I am trying to create an AnimatedList using bloc pattern, but ran into some problems.
When I am setting initialItemsCount of AnimatedList to state.itemList.length, it does not build. Although when I am printing out state.itemList (that comes from…

rdev
- 148
- 7
4
votes
4 answers
Flutter - How to wipe provider data after user signed out from app?
I am using provider for state management in my flutter application. I have implemented provider using Multiprovider.
I want to wipe provider data when the user signed out from the app I have read out this comment but don't understand it well.

Ranjit Shrestha
- 622
- 6
- 24
4
votes
1 answer
(Flutter) StreamBuilder returns only null
I am trying to create a "CategoryStream" to update the UI based on the users choice.
This is my stream:
import 'dart:async';
class CategoryStream {
StreamController _categoryStreamController =
StreamController();
closeStream()…

Arveni
- 68
- 6
4
votes
1 answer
List.remove() removes the correct object but the object's state in the list shifts as if last entry is being deleted
So I have been trying to solve this issue for a couple of days now and I seem to have hit a real dead end here.
The issue (which I have simplified in the code below) is that when I try to remove an item from a List<"SomeDataObject">, it does…

BryceTheGrand
- 643
- 3
- 9
4
votes
1 answer
What are the difference between business logic and UI logic?
I am learning state management in flutter and most of the time I encounter with words business logic ui logic and some time presentation logic, I searched it on the internet as people explain it in different languages, I couldn't get a better…

Muhammad
- 2,572
- 4
- 24
- 46
4
votes
1 answer
Navigator.push(): Error: Could not find the correct Provider above this Consumer Widget
Im trying to implement some basic state management in my Flutter app. Somewhere up the Widget tree I have a Provider for a User. Widgets further down can access the User using the Consumer User Widget. However one Widget (WidgetB in the code snipped…

yN.
- 1,847
- 5
- 30
- 47
3
votes
2 answers
SelectableRegion setState selection lost
In the following example I have a SelectableRegion containing a list of text widgets and I call setState() every second. If I remove 'SelectionContainer.disabled' in 'TextWidget' then the selection state survives setState, otherwise it loses the…

user123
- 632
- 1
- 6
- 22
3
votes
1 answer
SpeedDial: change color on click
I'm trying to do so that if I click on a SpeedDialChild (button) then the color of it changes, but even if the value of fun.switchTakePhoto changes from true to false (and vice versa) the color remains red for some reason.
class MainPage extends…

motijon963
- 33
- 4
3
votes
2 answers
Flutter CircularProgressIndicator() animation is not working inside Riverpod`s ref.watch().when
CircularProgressIndicator Screen Shot
I'm using Riverpod for state-management
CircularProgressIndicator occupies only 4 pixels under any conditions
I tested on a physical device and on an emulator
import 'package:flutter/material.dart';
import…

Chu Chun
- 35
- 6
3
votes
0 answers
How notifyListeners( ) actually works?
So, I have this class and I use the method addItem to add some item to my cart and itemsCount to have my total items show up in my cart icon in AppBar.
My question is, how the itemsCount is update after I use addItem if itemsCount does not…

Eduarda Garangau
- 31
- 1
3
votes
2 answers
autoDispose modifier in riverpod
I have multiple values (in class) in provider and when I use the autoDispose modifier in provider then I want to dispose of only a few values in the provider is it possible to do like this?
I have searched for this on the internet but I didn't find…
user18290458
3
votes
2 answers
Why are the variables in initState not acessible?
I want to create a TextController in the initState and then dispose of it like a good boy in dispose. But for some reason, the controller is not avaiable outside of the intiState:
class _InputFieldEnterThingState extends State…

Joe
- 311
- 3
- 17