getCurrentIpAddress method
Returns the current IP address of the device.
Implementation
Future<String?> getCurrentIpAddress() async {
try {
final response =
await http.get(Uri.parse('https://api.ipify.org?format=json'));
if (response.statusCode == 200) {
final jsonData = jsonDecode(response.body);
return jsonData['ip'];
}
} catch (_) {}
return null;
}