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

套件詳情v5.1.1

flutter_timezone

用於取得裝置本機時區的 Flutter 插件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
138萬
喜歡數
344
Pub 分數
160

安裝套件

flutter pub add flutter_timezone

套件介紹

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

flutter_timezone 是一個 Flutter 插件,可在多個平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上讓應用程式取得裝置的當地時區資訊。它提供簡單的 API 來存取目前的時區,讓處理時間相關作業更具本地化便利性。此套件特別適用於需要精確時區感知功能的應用程式,例如排程、日曆應用或顯示當地時間。該插件利用原生平台 API 以確保結果可靠。

適用情境

  • 以使用者友善的格式顯示本機時間
  • 基於用戶時區的排程事件
  • 建構日曆或提醒應用程式
  • 處理全球應用中的時區轉換
  • 確保多區域應用程式中的時間戳準確

主要特色

  • 跨平台時區檢測
  • 簡單且一致的 API
  • 支援所有主要的Flutter平台
  • 依賴於原生裝置的時區設定
  • 輕量且易於整合

適合對象

  • 需要準確處理本機時間的應用程式
  • 面向不同地區用戶的全球應用
  • 時間敏感的應用程式,如日曆和鬧鐘
  • 尋求最小化設定時區邏輯的開發者
  • 需要原生時區準確性的項目

使用建議

  • 在某些系統上需要適當的平台權限
  • 如果設備時區在執行期間發生變更,可能不會動態更新
  • 僅限讀取時區;不支援設定
  • 取決於設備級別的時區設定
  • 不適合超出檢索範圍的複雜時區計算

原始 README

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

flutter_timezone

pub package Keep a Changelog v1.1.0

A flutter plugin for getting the local timezone of the OS.

This is a fork of the original flutter_native_timezone due to lack of maintenance of that package.

Getting Started

Install this package and everything good will just follow along with you.

Usage examples

Get the timezone
final TimezoneInfo currentTimeZone = await FlutterTimezone.getLocalTimezone();
Localized timezone names

On supported platforms Timezone info will contain the localized timezone name. Currently, this is supported on:

  • Android
  • MacOS
  • iOS

Reference

Wikipedia's list of TZ database names

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案