address
处理国际化库。以各种语言格式化各种物理地址,并构建本地化的地址表单。
处理国际化库。以各种语言格式化各种物理地址,并构建本地化的地址表单。
以下为英文项目原文快照,最新内容请访问 GitHub。
Addresses internationalization library. Format various physical addresses in various languages and build localized address forms.
Given you have some address:
final address = Address(
fullName: 'Nicole Martin',
addressLine1: '123 Sherbrooke St',
city: 'Montreal',
zone: 'QC',
postalCode: 'H3G 2A6',
country: 'CA',
);
You can format it to your desired format:
final englishFormatter = AddressFormatter('en');
print(englishFormatter.formatDisplay(address));
// [
// 'NICOLE MARTIN',
// '123 SHERBROOKE ST',
// 'MONTREAL QC H3G 2A6',
// 'CANADA'
// ]
final frenchFormatter = AddressFormatter('fr');
print(frenchFormatter.formatDisplay(address));
// [
// 'Nicole Martin',
// '123 Sherbrooke St',
// 'Montreal (Québec) H2G 2A6',
// 'CANADA'
// ]
You can also get localized format of an address form with all obligatory and optional fields along with their labels and descriptions.
final addressFormatter = AddressFormatter('en');
final formFormat = addressFormatter.formatForm('US');
// formFormat = [
// // other fields: full name, addressLine1, addressLine2, city
// AddressFormFieldInformation(
// label: 'State',
// obligatory: true,
// availableValues: {
// // (...)
// 'TX': 'Texas',
// // (...)
// },
// ),
// // other fields: zip code
// ]
You can use this information to build e.g. a Flutter form. You can see how to do this by looking into the example.
先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗