Questions tagged [flutter-futurebuilder]

For questions relating to Flutter's FutureBuilder class. Use this tag in combination with the general [flutter] tag. If your question applies to Flutter more generally, use the [flutter] tag only.

Reference:

667 questions
146
votes
7 answers

Flutter StreamBuilder vs FutureBuilder

What is the main difference between StreamBuilder and FutureBuilder. What to use and when to use? What are the tasks they are intended to perform? How each of them listens to changes in a dynamic list?
74
votes
22 answers

Flutter: There should be exactly one item with [DropdownButton]'s value

I am trying to create a dropdown button in Flutter. I am getting a List from my database then I pass the list to my dropdownButton everything works the data is shown as intended but when I choose an element from it I get this error: There should be…
9
votes
3 answers

Getx is not working properly with FutureBuilder for update list

I'm using the Getx controller in my project. I have create the controller for FutureBuilder for displaying list but .Obs is not set on Future Function. I'm sharing the code. class PPHomeController extends GetxController { …
Alpit Panchal
  • 709
  • 1
  • 7
  • 25
9
votes
3 answers

Flutter : 'Future ' is not a subtype of type bool

I was trying to implement a simple login/logout functionality. My scenario is this: I have 2 pages ( login page and home page), In the main.dart, I am using SharedPreferences to check if a user has already logged in or not if the user is logged in,…
Arun-
  • 846
  • 3
  • 22
  • 41
8
votes
1 answer

Equality operator `==` invocation with references of unrelated types while using data_connection_checker package

To check for internet connection i am using data_connection_checker package but it seems that I am not getting how to use it. I am using following code to check internet connection by calling in initstate Widget _showDialog(String err,String…
Gautam Goyal
  • 230
  • 1
  • 4
  • 16
8
votes
4 answers

How to use RefreshIndicator to update FutureBuilder state?

I am using FutureBuilder to show the data loaded from server. I want to show the loading state only once when the app starts, that is why I am calling the API from initState. The data I get from server may change and to reflect the change in UI, I…
8
votes
1 answer

Condition must have static type of bool

Is there any way I can use a future bool in this type of condition, or is there a better way to do this? Widget _buildRow(String pair) { final Future alreadySaved = DBHelper.getAllEmployees().then((value) => value.contains(pair)); …
Adrita Rahman
  • 159
  • 1
  • 1
  • 13
7
votes
1 answer

flutter discarded_futures when using FutureBuilder

I feel like there is an issue with the linter rule discarded_future Is there a way to use the discarded_future lint rule without having to ignore the rule each time i'm using the FutureBuilder. Is that normal that the rule is triggered when using a…
7
votes
11 answers

The operator '[]' isn't defined for the type 'Object'. Try defining the operator '[]'

My code is given below the error I am facing issue in accessing the username from firebase in this line snapshot.data['username'] It gives the error mentioned above The only way I know to access the map data is this FutureBuilder( future:…
Abd ur Rehman
  • 183
  • 1
  • 2
  • 15
7
votes
2 answers

Flutter FutureBuilder refresh when TextField value changes

The _futureData is to used for the FutureBuilder after retrieving value from the _loadPhobias() function. entry_screen.dart Future _futureData; final TextEditingController _textEditingController = TextEditingController(); _loadPhobias() function…
6
votes
3 answers

passing dynamic strings to AppLocalizations.of(context)! in Flutter

right now Im working in App using Flutter and I have 4 different languages, I use json (arb files) for localization (translation) I need to pass different string values which app fetch them using API's as shown in example…
5
votes
0 answers

Flutter Hero in FutureBuilder

I am scratching my head to find an easy way to make a hero animation work when the target hero is in a FutureBuilder. I know this is not working because the hero image has to be be present on the very first frame of the second screen, which…
Mat
  • 81
  • 4
5
votes
2 answers

Flutter - How to update state (or value?) of a Future/List used to build ListView (via FutureBuilder)

Im pasting relevant code below, but you may be able to answer it based upon my pseudo-explanation. Im using a FutureBuilder to build a listview. I start off by using init() to async HTTP call the API and parse that into an List of objects…
4
votes
3 answers

Flutter - FutureBuilder fires twice on hot reload

In my flutter project when I start the project in the simulator everything works fine and the future builder only fires once, but when I do hot reload the FutureBuilder fires twice which causes an error any idea how to fix this? Future…
RyanBuss01
  • 203
  • 1
  • 11
4
votes
0 answers

Flutter : How to update widget state from background / service?

I'm new in flutter. I created an service with the android alarm manager plugin to get data from json Api every x minutes. That's ok. I use a stateful widget with streambuilder + futurebuilder to fetch my json data. At the first load, data are…
1
2 3
44 45