v1.5.3
http_client
一個跨平台的 HTTP 客戶端 API,支援瀏覽器、主控台和 curl(用於 SOCKS 代理)。
16喜歡 5900近 30 天下載150Pub 分數
AndroidiOSWebmacOSWindowsLinux
isoos/http_client open-source repository details.
以下為英文專案原文快照,最新內容請造訪 GitHub。
A platform-independent HTTP client API supporting browser, console, and curl (for SOCKS proxy). Planned platforms: Fetch API, node_io.
To develop your platform-agnostic library, use only the base import:
import 'package:http_client/http_client.dart' as http;
class MyServiceClient {
final http.Client httpClient;
MyServiceClient(this.httpClient);
}
For console apps:
import 'package:http_client/console.dart' as http;
main() async {
final client = http.ConsoleClient();
// use the client, eg.:
// new MyServiceClient(client)
await client.close();
}
For browser use, only change the first import:
import 'package:http_client/browser.dart' as http;
main() {
final client = http.BrowserClient();
// use the client, eg.:
// new MyServiceClient(client)
await client.close();
}