dart_ipify
このパッケージは、任意のIPアドレスから公開IPアドレスまたは地理的詳細情報を取得するために、リモートipifyウェブサービスを使用しています。
Dart用の非公式ipifyクライアントライブラリ。
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
An unofficial client library for Ipify <https://www.ipify.org/> A Simple Public IP Address API, Likewise a geographical IP address details API.
GitHub license pub package Opensource Workflow
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.
dependencies:
dart_ipify: ^1.1.1
Using this library is very simple. Here's a simple example:
import 'package:dart_ipify/dart_ipify.dart';
void main() async {
final ipv4 = await Ipify.ipv4();
print(ipv4); // 98.207.254.136
final ipv6 = await Ipify.ipv64();
print(ipv6); // 98.207.254.136 or 2a00:1450:400f:80d::200e
final ipv4json = await Ipify.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
}
import 'package:dart_ipify/dart_ipify.dart';
void main() async {
final mygeo = await Ipify.geo('at_apiKeyxxxxxxxxxxxxxxxxxxxxxxx');
print(mygeo.location);
final somegeo = await Ipify.geo('at_apiKeyxxxxxxxxxxxxxxxxxxxxxxx', ip: '8.8.8.8');
print(somegeo);
final balance = await Ipify.balance('at_apiKeyxxxxxxxxxxxxxxxxxxxxxxx');
print(balance);
}
All library #changes, in descending order.