imagesBySubBreed function

Future<List<String>> imagesBySubBreed(
  1. String breed,
  2. String subBreed
)

LIST ALL SUB-BREED IMAGES

  • breed breed name
  • subBreed sub_breed name

Returns list of all the images from the sub-breed

Implementation

Future<List<String>> imagesBySubBreed(String breed, String subBreed) async {
  try {
    var response = await _getRequest("breed/${breed.trim()}/${subBreed.trim()}/images");
    var json = jsonDecode(response);
    if (json["status"] != "success") {
      throw new DogAPIException(json["message"]);
    }
    List<String> list = [];
    for (var i in json["message"])
      list.add(i);
    return list;
  } catch(ex) {
    throw new DogAPIException(ex.toString());
  }
}