围绕 https://ipgeolocation.io/ api 的封装,用于通过http请求获取地理位置。在未获得权限时很有用。

功能

入门

用法

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);
}

GitHub

查看 Github