围绕 https://ipgeolocation.io/ api 的封装,用于通过http请求获取地理位置。在未获得权限时很有用。
功能
- 使用 https://ipgeolocation.io/ 作为底层API
入门
- 在 https://ipgeolocation.io/ 注册并获取api密钥
- 使用你刚刚收到的API密钥来使用这个库
用法
import 'package:ip_geolocation_io/ip_geolocation_io.dart';
void main(List<String> arguments) async {
if (arguments.isEmpty) {
throw 'You must give your api key as first argument, get one at https://app.ipgeolocation.io/';
}
final apiKey = arguments.first;
final geolocation = IpGeoLocationService(apiKey);
final response = await geolocation.getUserLocation();
print(response);
}