geocodeIp static method
获取ip所在地理信息
ip
ip地址
pathHead
资源头目录
hasGetCoordinate
是否获取经纬度
Implementation
static Future<GeocodeEntity> geocodeIp(
String ip, {
String pathHead = 'assets/',
bool hasGetCoordinate = false,
}) async {
try {
final id = await _getGeocodeByIp(ip, pathHead: pathHead);
var data = await _getGeocode(id);
if (hasGetCoordinate) {
data = await _getCoordinate(data);
}
return data;
} catch (e) {
return GeocodeEntity.empty();
}
}