getIP method

  1. @override
Future<String> getIP()
override

Retrieves the IP address.

Implementation

@override
Future<String> getIP() async {
  try {
    var ipAddress = IpAddress(type: RequestType.json);
    dynamic data = await ipAddress.getIpAddress();
    return data['ip'].toString();
  } on IpAddressException catch (exception) {
    debugPrint(exception.message);
    return 'Failed to get IP address.';
  }
}