getValue static method
Implementation
static Future<Location?> getValue() async {
http.Response response = await http.get(
Uri.parse('http://ip-api.com/json'),
);
if (response.statusCode != 200) {
Future.error('Failed to get location');
}
return Location.fromJson(jsonDecode(response.body));
}