搜尋套件、儲存庫與 APP 分類

套件詳情v1.2.0

country_code

提供 ISO 3166-1 國家代碼清單,以類似列舉的類別形式呈現,以及解析和使用者指派的代碼元素

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
5.7萬
喜歡數
20
Pub 分數
160

安裝套件

flutter pub add country_code

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

country_code 套件提供了一個全面的、類似列舉的類別,包含 ISO 3166-1 國家代碼,可輕鬆存取標準化的國家識別碼。它支援從字串解析國家代碼,並允許使用者自訂代碼指派。適用於需要國家選擇、地區化或根據國家代碼進行資料驗證的應用程式。此套件輕量且相容於所有主要平台,包括 Android、iOS、Web、macOS、Windows 與 Linux。

適用情境

  • 表單中的國家選擇
  • 本地化和基於區域的內容
  • 使用者資料國家輸入
  • 使用 ISO 代碼進行資料驗證
  • 國際電話號碼格式化

主要特色

  • ISO 3166-1 國家代碼枚舉
  • 國家代碼的字串解析
  • 對自定義國家代碼映射的支援
  • 跨平台相容性
  • 輕量且易於整合

適合對象

  • 面向國際用戶的移動應用
  • 需要國家數據的Web應用程式
  • 需要國家選擇的表單輸入
  • 支援多種語言和區域的應用程式

使用建議

  • 需要手動處理非標準國家條目
  • 僅限 ISO 3166-1 代碼
  • 沒有用於選擇器功能的內建UI組件

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

List of ISO 3166-1 assigned country codes.

pub package License

Features

  • [x] ISO 3166-1 alpha-2. alpha-3, and numeric country codes in enum-like class
  • [x] Parsing of country codes from string
  • [x] Support for user-assigned code elements

Usage

import 'package:country_code/country_code.dart';

var code = CountryCode.tryParse("US");
if (code == CountryCode.US) {
  print(code.alpha2);
  print(code.alpha3);
  print(code.numeric);
}

See more examples

Bugs and feature requests

Please file feature requests and bugs at the issue tracker.

所屬分類

原始碼儲存庫

使用此套件的專案