Flutter 国家

查询和检索来自包含 250 个国家的数据库的按属性类型划分的国家详细信息。 TODO:在此处添加您的许可证。

  • 国家总数:250
  • 州/地区/市总数:4,979
  • 城市/城镇/区总数:148,266

查看可用数据的用法方法。

数据来源: Countries States Cities Database

特点

  • 离线工作
  • 按子字符串进行异步查询
  • 按子字符串搜索,从而实现模糊搜索
  • 匹配并返回相似或精确的结果

用法 – Countries

按属性和子字符串检索国家列表。

import 'package:country/country.dart';

await Countries.all;
await Countries.byCapital(capital);
await Countries.byCoords(longitude, latitude);
await Countries.byCurrencyName(currencyName);
await Countries.byId(id);
await Countries.byIso2(iso2);
await Countries.byIso3(iso3);
await Countries.byName(name);
await Countries.byNative(native);
await Countries.byNumericCode(numericCode);
await Countries.byPhoneCode(phoneCode);
await Countries.byRegion(region);
await Countries.bySubRegion(subRegion);
await Countries.byTimeZoneAbbreviation(timeZoneAbbreviation);
await Countries.byTimeZoneGmtOffset(timeZoneGmtOffset);
await Countries.byTimeZoneGmtOffsetName(gmtOffsetName):
await Countries.byTimeZoneTzName(timeZoneTzName);
await Countries.byTimeZoneZoneName(zoneName);
await Countries.byTld(tld);
await Countries.byTranslation(translation);

用法 – States

按属性和子字符串检索州列表。

import 'package:country/country.dart';

await States.all;
await States.byCoords(longitude, latitude);
await States.byCountryCode(countryCode);
await States.byCountryId(countryId);
await States.byCountryName(countryName);
await States.byId(id);
await States.byLatitude(latitude);
await States.byLongitude(longitude);
await States.byName(name);
await States.byStateCode(stateCode);
await States.byType(type);

用法 – Cities

按属性和子字符串检索城市列表。

import 'package:country/country.dart';

  await Cities.all;
  await Cities.byCoords(longitude, latitude);
  await Cities.byCountryCode(countryCode);
  await Cities.byCountryName(countryName);
  await Cities.byId(id);
  await Cities.byLatitude(latitude);
  await Cities.byLongitude(longitude);
  await Cities.byName(name);
  await Cities.byStateCode(stateCode);
  await Cities.byStateId(stateId);
  await Cities.byStateName(stateName);
  await Cities.byWikiDataId(wikiDataId);
  await Cities.bycountryID(countryId);

附加信息

需要对查询进行改进。

Paurini Wiringi

GitHub

查看 Github