randomImage function

Future<String> randomImage()

DISPLAY SINGLE RANDOM IMAGE FROM ALL DOGS COLLECTION

Returns a random dog image

Implementation

Future<String> randomImage() async {
  try {
    var response = await _getRequest("breeds/image/random");
    var json = jsonDecode(response);
    if (json["status"] != "success") {
      throw new DogAPIException(json["message"]);
    }
    return json["message"];
  } catch(ex) {
    throw new DogAPIException(ex.toString());
  }
}