[ {
banner_image: banner5.jpeg
}, {
banner_image: banner4.jpeg
}, {
banner_image: banner3.jpeg
}, {
banner_image: banner2.jpeg
}, {
banner_image: banner1.jpeg
},
]
I have fetched this data from json url and i just want the .jpeg values in string format
CodePudding user response:
You can convert your json to list of string then use it seperatly
List stringList = (jsonDecode(input) as List).cast();
String strBanner1 = stringList[0]; String strBanner2 = stringList[1]; . . .
CodePudding user response:
Hope these codes help.
List<String> imageList=[]
http.Response? response;
response = await api.getRequest(apiUrl2,
"YOUR-API-URL");
if (response != null && response.statusCode == 200) {
List<String> apiResponse = <String>[];
List<dynamic>? values = json.decode(response.body);
if (values != null) {
for (int i = 0; i < values.length; i ) {
if (values[i] != null) {
Map<String, String> map = values[i];
imageList.add(map.Value);
}
}
}
return imageList;