isUrlAvailable static method
Implementation
static Future<bool> isUrlAvailable(String host, String path) async {
http.Client client = http.Client();
try{
final http.Response response = await client.get(
Uri.https(host, path)
);
if(response.statusCode == 200){
print('URL AVAILABLE!');
return true;
}
} catch(e){
print('URL UNAVAILABLE!');
return false;
} finally{
client.close();
}
return false;
}