WhatIsMyIp class

A class that provides functionality to retrieve IP addresses and their geolocation information.

This class uses two external APIs:

Example usage:

final ipService = WhatIsMyIp();

// Get current IP address
final ipAddress = await ipService.getIpAddress();

// Get geolocation for current IP
final geolocation = await ipService.getIpGeolocation(
  apiKey: 'your_api_key_here'
);

// Get geolocation for specific IP
final specificGeolocation = await ipService.getIpGeolocation(
  apiKey: 'your_api_key_here',
  ip: '8.8.8.8'
);

Constructors

WhatIsMyIp.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getIpAddress() Future<String>
Retrieves the current IP address using the Ipify API.
getIpGeolocation({required String apiKey, String? ip}) Future<IpGeolocation>
Retrieves geolocation information for an IP address using the IP2Location API.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited