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
2
votes
2 answers

Error: A non-null value must be returned since the return type 'Widget' doesn't allow null

Using a FutureBuilder, I get the following errors. Error: The argument type 'AsyncSnapshot' can't be assigned to the parameter type 'Position'. Pointing to line: return Map(snapshot); Error: A non-null value must be returned since the return type…
NinFudj
  • 109
  • 1
  • 12
2
votes
2 answers

Provider plus FutureBuilder in Stateless Widget Confusion

So, I've seen examples of using the initState function to load data (http) into a provider for a stateful widget. But if the widget is stateless, I'm not sure what the best approach is. What I've done is the following: class GamesGrid extends…
Gregg
  • 34,973
  • 19
  • 109
  • 214
2
votes
1 answer

Flutter dynamic list, not-null validation

I've been trying to create a list of Flutter Widgets to use them in a slider. I'm fetching the data from JSON file, and passing it as Future to FutureBuilder. However, when trying to build my app, Error message pops up: Error: Operator '[]'…
Heinzest
  • 21
  • 4
2
votes
1 answer

FutureBuilder in TabBarView not updating appropriately

I have a very simple setup. A TabBarView with 2 tabs. On the first tab the user would choose an option. With this first option, something would be loaded from an API to display on the second tab in a FutureBuilder. The problem is that the…
user3217163
  • 67
  • 1
  • 6
2
votes
3 answers

What exactly means the snapshot in a Futurebuilder in Flutter?

I'm not sure if I got the snapshot thing in Flutter right. Therefore I would like to ask you guys if you aggree my thoughts about snapshot or not. Let's say I have the FutureBuilder below: FutureBuilder( future: someFutureFunction(), …
Ayrix
  • 433
  • 5
  • 16
2
votes
1 answer

Firestore: How to retrieve data from an array and deliver it into a table?

I am building a nutrition app for practice. Right now I got a collection named "inventar" which stores a document, containing two arrays. "product" is an array which contains all products, like milk, sausage, cheese etc. Another array,…
2
votes
1 answer

Flutter: Async call inside FutureBuilder

I have an asynchronous call which gets me a list of objects from which I generate a ListView with ListView.builder. Each object has a property called usedId which is an integer. I'm trying to get a user object based in its id. This is my…
Gabi
  • 103
  • 3
  • 9
2
votes
2 answers

how to change the state inside FutureBuilder

i just need when the user open the screen the notification icon button change when he click, it's value is coming from shared preferences. the problem is the icon is never changed! the initState code: @override void initState() { …
user15543853
2
votes
2 answers

initialData in FutureBuilder - Flutter

What is the purpose of initialData in FutureBuilder? The documentation says:- The data that will be used to create the snapshots provided until a non-null future has completed Does that mean the placeholder data that gets shown to the user when…
2
votes
1 answer

Reorderable ListView with future builder in Flutter

I am trying to implement a Reorderable ListView into a FutureBuilder but currently I'm running into an error and got no idea what this means. My future Widget 'WidgetLook' already got a key assigned to it. Here is my Future Builder code: child:…
2
votes
4 answers

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

I am building an app for an e-commerce system which can post data to the server. There are multiple item categories which have different and customizable values. For example, laptop category can have processor, ram, storage size attributes. Some of…
Abdi Nur
  • 490
  • 4
  • 9
2
votes
0 answers

Can I use Either in FutureBuilder?

I use Either to fetch data by REST API as below: Future>> getApi() async { ... if (ERROR) { return Left(ERROR); else { return Right(RESPONSE); } Then I want to get data as below: FutureBuilder…
mikezang
  • 2,291
  • 7
  • 32
  • 56
2
votes
3 answers

How to Overlay and Center Circular Progress Indicator with FutureBuilder Flutter

I have a FutureBuilder that shows a CircularProgressIndicator while data is being fetched. Currently, the CircularProgressIndicator shows up at the top left corner of my screen and when it shows, nothing else is on the screen behind it. I would like…
CuriousCoder
  • 262
  • 4
  • 14
2
votes
1 answer

Flutter async method keeps running even after the corresponding widget is removed

I have a list of image paths and I am using the List.generate method to display images and a cross icon to remove image from list. Upload method is called on each image and when I remove the image from the list the method still keeps running until…
2
votes
1 answer

Flutter how to call multiple api(with futurebuilders) in one screen?

I am building a home page with rest api and using http library. I can get latest posts from my api call. But I am building a Home Page and So I have to show more data from my rest api. Using Wordpress as back end. I want to fetch 5 posts from 3-4…
Mayanktaker
  • 175
  • 5
  • 14