ip_hunter 1.0.2
ip_hunter: ^1.0.2 copied to clipboard
A Flutter package to retrieve the device's network IP address and fetch detailed location information, such as city, region, and country based on the connected network.
ip_hunter #
Fetch ip address, region and location info.
Getting Started #
IP Hunter
A Flutter package to retrieve the device's network IP address and fetch detailed location information, such as city, region, and
country based on the connected network.
Implementation #
- To use this package, add the package to your pubspec.yaml file:
dependencies:
ip_hunter: ^1.0.0
- Import the package :
import 'package:ip_hunter/ip_hunter.dart';
- Usage: With future widge t
FutureBuilder<String>(
future: _ipHunterPlugin.getPublicIPAddress(), // async work
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting: return const Text('Loading....');
default:
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
return Text('IP: ${snapshot.data}', style: TextStyle(fontSize: 17),);
}
}
},
),
A function with the method :
final _ipHunterPlugin = IpHunter();
Future getIP() async {
var ip = await _ipHunterPlugin.getPublicIPAddress();
print("ip is $ip");
}
Note: #
Ensure your app has internet access, as this package requires network connectivity to fetch the IP and location details. The package uses publicly available APIs to provide location details based on the network IP address.
Details: #
The package provides the following methods:
Method | Description | Returns |
---|---|---|
getNetworkIpAddress() | Fetches the network's IP address. | String |
getCity() | Retrieves the city associated with the IP. | String |
getRegion() | Retrieves the region/state for the IP. | String |
getCountry() | Retrieves the country associated with the IP. | String |

Developed by:
Pranav Patel
Personal email - pranav.patel2001@gmail.com
Work email - pranavp@fermion.in
LinkedIn - https://www.linkedin.com/in/pranav-patel-7b06a4188
Publisher's Linkedin - https://www.linkedin.com/company/fermioninfotech?trk=profile-position