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

套件詳情v0.3.1

sync_http

Dart 的同步 HTTP 客戶端。

AndroidiOSmacOSWindowsLinux
近 30 天下載
959萬
喜歡數
16
Pub 分數
120

安裝套件

flutter pub add sync_http

套件介紹

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

sync_http 是 Dart 的同步 HTTP 客戶端,設計用於簡化在異步操作不理想環境中的 HTTP 請求。它提供了一個直觀的 API,用於同步執行 GET、POST、PUT 等 HTTP 方法,阻塞執行直到收到回應。這使其適用於需要簡單線性控制流程的場景,例如 CLI 工具或腳本。該套件由 Google 維護,支援多個平台,包括 Android、iOS、macOS、Windows 和 Linux。

適用情境

  • 命令列工具
  • 腳本工作流程
  • 簡單數據獲取
  • 同步後端處理
  • 測試 HTTP 互動

主要特色

  • 同步請求處理
  • 簡單直覺的 API
  • 跨平台支援
  • 輕便且簡約
  • 內建錯誤處理

適合對象

  • 需要阻塞式HTTP呼叫的開發者
  • 非UI應用程式
  • 原型設計與測試
  • 舊代碼整合
  • 簡單的自動化腳本

使用建議

  • 由於具有阻塞特性,不適用於UI執行緒
  • 與非同步替代方案相比,可擴展性有限
  • 在高吞吐量場景下可能導致性能問題
  • 僅在非互動式環境中使用最佳

原始 README

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

Dart CI pub package package publisher

A Dart HTTP client implemented using RawSynchronousSockets to allow for synchronous HTTP requests.

Using this package

Note: this package is only intended for very specialized use cases. For general HTTP usage, please see instead package:http.

This library should probably only be used to connect to HTTP servers that are hosted on 'localhost'. The operations in this library will block the calling thread to wait for a response from the HTTP server. The thread can process no other events while waiting for the server to respond. As such, this synchronous HTTP client library is not suitable for applications that require high performance. Instead, such applications should use libraries built on asynchronous I/O, including dart:io and package:http, for the best performance.

所屬分類

原始碼儲存庫

使用此套件的專案