• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How to use API in Dropdown list in Flutter?

Resolved: How to use API in Dropdown list in Flutter?

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

Output in Working Condtion Hello Flutter/Dart Programmers, I’m new in Flutter. below code about Dropdown is working without API, but i wants API data to display in Dropdown list…. i need help
Output Pic is attach with working condition but without API/JSON. but i wants API data to display in Dropdown list….

Answer:

Use FutureBuilder to build widgets which requires Future value.
You can return new list of DropDownMenuIems from your getAllCategory() method Instead of updating old Items. Like:
Then you can give getAllCategory() as future of FutureBuilder. FutureBuilder will build different widgets according to the provided Future. you can return CircularProgressIndicator until future doesn’t have value. After getting your DropDownMenuItems you can return your DropDownMenu. Like:
Full Code:

If you have better answer, please add a comment about this, thank you!

api dart dropdown flutter json
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Is pandas groupby() function always produce a DataFrame with the same order respect to the column we group by?

24/03/2023

Resolved: Kivy widget hierarchy not behaving as expected

24/03/2023

Resolved: Pandas Groupby Get Values from Previous Group

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.