bodyToPixabayResponse static method

PixabayResponse? bodyToPixabayResponse(
  1. dynamic data,
  2. dynamic jsonString
)

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);
  }
}