IP static method
Implementation
static Future<Map<String, dynamic>> IP() async {
try {
bool result = await InternetConnectionChecker().hasConnection;
if (!result) return {"status": ""};
final response = await http
.get(Uri.parse('https://ipinfo.io/json'))
.timeout(30.seconds, onTimeout: () => http.Response('', 500));
if (response.body.isNotEmpty) {
return json.decode(response.body);
} else {
return {"status": ""};
}
} catch (e) {
return {"status": ""};
}
}