how to select just one item from json in flutter


Hi i want to show SPX price in my app and have this json API i need to select just SPX data fron this API how can i do that??





You can do this:

final lst = [{"ask":"28.47500","bid":"27.47500","name":"USDUAH","time":"1616772920.000"},

final res = lst.where((element) => element['name'] == 'SPX').toList();

Check out the full example on DartPad here

Answered By – Bach

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *