简体   繁体   中英

How to sort data from API data in Flutter

Im trying to sort the data from api to Ascending & Descending inside Datatable Widget i follow the code and implementation however it doesn't work in my end Im using FutureBuilder to call the data any idea and help will be appreciated.

kindly see the link i post it to my personal github account as i have struggle to post the code here is the link : https://github.com/shanjoh/sorting-code/tree/6029c07e53921e96c8b6d6e218329e13246d2370

if you store value like this

    `List<YourModel> sortdata =  snapshot.data!.sort((a, b) => -a.ccy.compareTo(b.ccy));`

then you assign sortData in your card

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