bodyToPixabayResponse static method
Implementation
static PixabayResponse? bodyToPixabayResponse(data, jsonString) {
if (data != null && data.length > 0) {
List<PixabayImage> images =
List<PixabayImage>.generate(data['hits'].length, (index) {
return PixabayImage.fromJson(data['hits'][index]);
});
return PixabayResponse(
body: jsonString,
total: data["total"],
totalHits: data["totalHits"],
hits: images);
}
}