GitHub 저장소sumanrajpathak/public_ip_address

공용 IP 주소

sumanrajpathak/public_ip_address open-source repository details.

공용 IP 주소 프로젝트 이미지
스타
20
포크
3
최근 푸시(UTC)
2026. 7. 3.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

Public IP Address

pub package

package publisher

This package allows you to obtain your public IP address and many other information about it

Features

You can get the public IP address of the user or many other information about a specific IP address, such as :

  • Name of the country
  • Time Zone
  • Latitude
  • Longitude
  • Name of the City
  • Name of the Region
  • Region Code
  • Postal Code
  • The organization or Internet service provider
  • Continent Code
  • Two-letter ISO 3166-1 alpha-2 country code
  • Three-letter ISO 3166-1 alpha-3 country code
  • The UTC time offset
  • The Asn

Getting started

Add this to your dependencies :

dependencies:

  public_ip_address: ^1.2.2

And import :

import 'package:public_ip_address/public_ip_address.dart';

Usage

To get your ip address, just use IpAddress().getIp():

import 'package:public_ip_address/public_ip_address.dart';

void main() async {
  IpAddress _ipAddress = IpAddress();
  var ip = await _ipAddress.getIp();
  print(ip);
  // Sample Output : 208.67.222.222
}

Don't forget to await it because it's a Future function.

Others functionalities

  • To get all data about the user's IP address , use getAllData() :
Map allData = await IpAddress().getAllData();

For a specific ip , use getAllDataFor('specific_ip') method instead .

  • To get only the user's IP address, use : IpAddress().getIp():
String ip = await IpAddress().getIp();
// Sample Output : "208.67.222.222"
  • To get the Ipv4 (Ip version 4) address value of the user's IP , use : IpAddress().getIpv4():
String ipv4 = await IpAddress().getIpv4();
// Sample Output : "208.67.222.222"
  • To get the Ipv6 (Ip version 6) address value of the user's IP , use : IpAddress().getIpv6():
String ipv6 = await IpAddress().getIpv6();
// Sample Output : "2a05:dfc7:5::53"
  • To get the Continent Code of the user's IP , use : IpAddress().getContinentCode():
String continentCode = await IpAddress().getContinentCode();
// Sample Output : "NA"

For a specific ip , use getContinentCodeFor('specific_ip') method instead .

  • To get the Country of the user's IP , use : IpAddress().getCountry():
String country = await IpAddress().getCountry();
// Sample Output : "United States"

For a specific ip , use getCountryFor('specific_ip') method instead .

  • To get the Two-letter ISO 3166-1 alpha-2 country code of the user's IP , use : IpAddress().getCountryCode():
String countryCode = await IpAddress().getCountryCode();
// Sample Output : "US"

For a specific ip , use getCountryCodeFor('specific_ip') method instead .

  • To get the Three-letter ISO 3166-1 alpha-3 country code of the user's IP , use : IpAddress().getCountryCode3():
String countryCode3 = await IpAddress().getCountryCode3();
// Sample Output : "USA"

For a specific ip , use getCountryCode3For('specific_ip') method instead .

  • To get the Latitude of the user's IP , use : IpAddress().getLatitude():
double latitude = await IpAddress().getLatitude();
// Sample Output : 37.7697

For a specific ip , use getLatitudeFor('specific_ip') method instead .

  • To get the Longitude of the user's IP , use : IpAddress.getLongitude():
double longitude = await IpAddress().getLongitude();
// Sample Output : -122.3933

For a specific ip , use getLongitudeFor('specific_ip') method instead .

  • To get the TimeZone of the user's IP , use : IpAddress().getTimeZone():
String timeZone = await IpAddress().getTimeZone();
// Sample Output : "America\/Los_Angeles"

For a specific ip , use getTimeZoneFor('specific_ip') method instead .

  • To get the UTC time offset of the user's IP , use : IpAddress().getOffset():
int offset = await IpAddress().getOffset();
// Sample Output : -7

For a specific ip , use getOffsetFor('specific_ip') method instead .

  • To get the organization or Internet service provider (ASN + ISP name) of the user's IP , use : IpAddress().getOrganization():
String organization = await IpAddress().getOrganization();
// Sample Output : "AS36692 OpenDNS, LLC"

For a specific ip , use getOrganizationFor('specific_ip') method instead .

  • To get the Name of the Region of the user's IP , use : IpAddress().getRegion():
String region = await IpAddress().getRegion();
// Sample Output : "New York"

For a specific ip , use getRegionFor('specific_ip') method instead .

  • To get the Region Code of the user's IP , use : IpAddress().getRegionCode():
String regionCode = await IpAddress().getRegionCode();
// Sample Output : "NY"

For a specific ip , use getRegionCodeFor('specific_ip') method instead .

  • To get the Name of the city of the user's IP , use : IpAddress().getCity():
String city = await IpAddress().getCity();
// Sample Output : "Brooklyn"

For a specific ip , use getCityFor('specific_ip') method instead .

  • To get the Postal code/Zip code of the user's IP , use : IpAddress().getPostalCode():
String postalCode = await IpAddress().getPostalCode();
// Sample Output : "11213"

For a specific ip , use getPostalCodeFor('specific_ip') method instead .

Additional information

Some countries do not have region and other information. For example, for some IP addresses outside the United States and Canada, information such as region, regionCode, city and postalCode may not be found.

Suman Raj Pathak GitHub avatar
GitHub 작성자

Suman Raj Pathak ↗

Software Engineer

@wesionaryTEAMNepal
언어Dart

분류

사용 중인 의존성

의존성 목록 4 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗