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

套件詳情v5.11.1

dio

一個強大的 HTTP 網路請求套件,支援攔截器、中止與取消請求、自訂適配器、轉換器等。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
522萬
喜歡數
8370
Pub 分數
160

安裝套件

flutter pub add dio

套件介紹

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

Dio 是一個強大的 Dart 與 Flutter HTTP 客戶端,專為高效且靈活的網路請求而設計。它支援進階功能,例如攔截器用於修改請求/回應、請求取消、自訂適配器以及資料處理的轉換器。Dio 可在所有主要平台(包含 Android、iOS、Web、macOS、Windows 和 Linux)上運作,非常適合跨平台應用。其乾淨的 API 與可擴展性讓開發者能輕鬆處理複雜的網路情境。Dio 以效能與開發者體驗為核心打造,廣泛應用於生產環境。

適用情境

  • 呼叫 REST API
  • 透過攔截器處理驗證權杖
  • 取消進行中的請求
  • 實現重試邏輯
  • 轉換請求/回應資料
  • 建構離線優先的應用程式

主要特色

  • 請求/回應操作的攔截器
  • 請求取消和中止
  • 適用於不同環境的自定義適配器
  • 序列化/反序列化的資料轉換器
  • 支援檔案上傳和下載
  • 跨平台相容性

適合對象

  • 移動應用開發
  • Web 應用程式
  • 桌面應用程式
  • API 結合專案
  • 需要高級網絡控制的應用程式
  • 需要強大HTTP處理功能的團隊

使用建議

  • 需要理解 HTTP 生命周期
  • 可能需要額外的錯誤處理設定
  • 不適用於未經自訂的簡單 GET 請求
  • 有限的內建快取(建議使用外部解決方案)
  • 特定於平台的行為可能需要測試

原始 README

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

dio

Language: English | 简体中文

This is the base repo of the dio project. Please move to specific paths for project instructions.

Don't forget to add #dio topic to your published dio-related packages! See more: https://dart.dev/tools/pub/pubspec#topics

Versioning

Before you upgrade: Breaking changes might happen in major and minor versions of packages.
See the Migration Guide for the complete breaking changes list.

To know about our compatibility policy, see the Compatibility Policy doc.

All Packages

dio
Plugins
  • cookie_manager: link Pub
  • compatibility_layer: link Pub
  • http2_adapter: link Pub
  • native_dio_adapter: link Pub
  • web_adapter: link Pub
Examples
  • example: link
  • example_flutter_app: link

Copyright & License

The project and its underlying projects are originally authored by @wendux with the organization @flutterchina, started being maintained by Chinese Flutter User Group (@cfug) since 2023.

The project consents the MIT license.

所屬分類

依賴

依賴清單 7 項

原始碼儲存庫

使用此套件的專案

所在榜單