简体   繁体   中英

How to Display All the Images from Json Data into Carousal using Flutter

I have an Json API which has set of Data along with Multiple Images, I would like to Create an Carousal and Display all the images from the json data in flutterjson数据

You can use carousel_slider for carousel and for images u can use Image.network or Cached network image

You should always try to include in your question what you have already attempted and what specific problems you're facing, however it's quite a straightforward answer so here's the gist of how to do it.

You can get your raw API data using the http package and a get request. Once you have this, you can decode it using jsonDecode(String data) , which returns a Map<String, dynamic> . You can then select the list field as in any map object ( jsonMap['images'] ) and use the list .map method to create a list of Image.network widgets to use as the children in you carousel package of choice (or build your own).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM