ipwhois

Last updated:

0 purchases

ipwhois Image
ipwhois Images
Add to Cart

Description:

ipwhois

ipwhois #

By using ipwhois package, you can get information about the IP of your Internet connection.
such as IP address v4 and v6, city name, country name, region, latitude and longitude, continent code, timezone, Internet provider organization ....

After the answer comes and the country or city is specified, you can render different designs based on the type of country or city.
Changing the language of the application by identifying different IPs.

🌐 🛜 💻 📱
Install Package #
add the following line to your pubspec.yaml under dependencies:
dependencies:
ipwhois: ^1.1.0
copied to clipboard
then run:
dart pub get
copied to clipboard
or
flutter pub get
copied to clipboard
Getting started #
Android #
add this permission to your <project root>/android/app/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET"/>
copied to clipboard
import it
import 'package:ipwhois/ipwhois.dart';
copied to clipboard
Usage #
now in your dart code, you can use:
final IpInfo? resultV4 = await getMyIpInfo();
print(resultV4); // ip: 5.200.119.128, continentCode: AS, country: Iran, countryCode: IR, countryCode3: IRN, region: Tehran, regionCode: 23, city: Tehran, latitude: 35.7108, longitude: 51.4274, timezone: Asia/Tehran, offset: 12600, asn: 57218, organization: Rightel Communication Service Company PJS

if (resultV4 != null) {
print(resultV4!.ip); // ip: 5.200.119.128
print(resultV4.city); // Tehran
print(resultV4.country); // Iran
print(resultV4.countryCode); // IR
print(resultV4.latitude); // 35.7108
print(resultV4.longitude); // 51.4274
print(resultV4.continentCode); // AS
print(resultV4.region); // Tehran
print(resultV4.regionCode); // 23
print(resultV4.organization); // Rightel Communication Service Company PJS
}

final resultV6 = await getMyIpInfo(version: IpVersion.v6);
print(resultV6); // null
copied to clipboard
you can only request to get the IP
final String? myIpV4 = await getMyIp();
print(myIpV4); // 77.73.69.217

final String? myIpV6 = await getMyIp(version: IpVersion.v6);
print(myIpV6); // 2a00:1838:37:21e::d3bc
copied to clipboard
by Shervin Hassanzadeh #
contact me at

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.