connectivity_plus 是一個 Flutter 插件,可讓應用程式在 Android、iOS、Web、macOS、Windows 和 Linux 上偵測並回應網路連線變更。它提供有關目前活躍連線類型(例如 WiFi、行動數據或無連線)的即時資訊,讓開發者能夠建構能適應網路可用性的強韌應用程式。此套件提供跨平台的簡單且一致的 API,非常適合處理離線情境、同步資料或顯示網路狀態指示器。
適用情境
即時監控網路狀態
優雅地處理離線模式
顯示連接指示器
自動重試失敗的請求
根據連接類型優化資料使用
主要特色
跨平台支援(Android、iOS、Web、macOS、Windows、Linux)
即時連接狀態更新
檢測WiFi和移動數據連接
同時支援初始狀態和基於流的監控
簡單直覺的 API,設定最少
適合對象
需要可靠網絡感知的應用程式
離線可用的應用程式
需要連接上下文的資料密集型服務
針對多個平台且行為一致的開發者
使用建議
在 Android 和 iOS 上需要平台特定的權限
Web 支援可能會因瀏覽器而有所限制
無法檢測互聯網存取——僅本地連接
可能需要額外的邏輯來驗證實際的互聯網連通性
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Plus plugins
PlusPlugins is a set of Flutter plugins that is developed based on plugins, which previously existed
as a part of Flutter plugins, with extra functionalities,
support for more platforms and better maintenance.
Please file PlusPlugins specific issues, bugs, or feature requests in our issue tracker.
Plugin issues that are not specific to PlusPlugins can be filed in the Flutter issue tracker.
Contributing
If you wish to contribute a change to any of the existing plugins in this repo,
please review our contribution guide
and open a pull request.
Status
This repository is maintained by FlutterCommunity authors. Issues here are answered by maintainers and other community members on GitHub on a best-effort basis.