dart_ipify パッケージは、ipify API を使用してパブリック IP アドレスまたは地理情報の取得を簡単に行う方法を提供します。Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートしており、ネットワークID情報を必要とするクロスプラットフォームアプリケーションに最適です。このパッケージは ipify サービスへの HTTP 要求を抽象化し、IP データの取得に使いやすいシンプルなメソッドを提供しています。リアルタイムでの IP 検索機能が必要なアプリケーション向けに軽量かつ信頼性が高いです。
An unofficial client library for Ipify <https://www.ipify.org/>A Simple Public IP Address API, Likewise a geographical IP address details API.
About ipify
Using ipify is ridiculously simple. You can get your public IP directly or you can get the precise physical location of a given IP address. so if you only have as much as an IP address, you can still find out its geographical details.
This library makes getting your public IP address or the precise geographical details of a given IP address with the dart language extremely simple using Ipify's API.
Installation
dependencies:dart_ipify:^1.1.1
Usage
Using this library is very simple. Here's a simple example:
IP Address API
import'package:dart_ipify/dart_ipify.dart';
voidmain() async {
final ipv4 = awaitIpify.ipv4();
print(ipv4); // 98.207.254.136final ipv6 = awaitIpify.ipv64();
print(ipv6); // 98.207.254.136 or 2a00:1450:400f:80d::200efinal ipv4json = awaitIpify.ipv64(format: Format.JSON);
print(ipv4json); //{"ip":"98.207.254.136"} or {"ip":"2a00:1450:400f:80d::200e"}// The response type can be text, json or jsonp
}
IP Geolocation API
import'package:dart_ipify/dart_ipify.dart';
voidmain() async {
final mygeo = awaitIpify.geo('at_apiKeyxxxxxxxxxxxxxxxxxxxxxxx');
print(mygeo.location);
final somegeo = awaitIpify.geo('at_apiKeyxxxxxxxxxxxxxxxxxxxxxxx', ip: '8.8.8.8');
print(somegeo);
final balance = awaitIpify.balance('at_apiKeyxxxxxxxxxxxxxxxxxxxxxxx');
print(balance);
}