http_client
1.5.3, released 3 years ago by agilord.com
Platform‑independent HTTP client for browser, console and curl with SOCKS proxy support
What it does
Provides a single Client API that works on web, mobile, desktop and console. It can use the browser fetch API, a console implementation or curl for SOCKS proxies. The API mimics the package:http Client interface.
AI-written summary of version 1.5.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need a single HTTP client that works across all Dart platforms
- Want to use curl for SOCKS proxy support
- Building a library that should be platform‑agnostic
- Need a lightweight alternative to dio for simple requests
Skip it when
- Already using dio or http for all platforms
- Require advanced features like interceptors, multipart, or reactive streams
Strengths
- Platform‑agnostic API
- Supports browser, console, and curl with SOCKS proxy
- Low dependency footprint
- Simple drop‑in replacement for package:http Client
Weaknesses
- Limited feature set compared to dio (no interceptors, multipart, etc.)
- No built‑in retry or timeout configuration beyond basic options
- Documentation is minimal
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add dependency in pubspec and import the desired implementation (console.dart, browser.dart, or http_client.dart). No build_runner or permissions required.
import 'package:http_client/http_client.dart' as http;
class MyServiceClient {
final http.Client httpClient;
MyServiceClient(this.httpClient);
}
void main() async {
final client = http.ConsoleClient();
final response = await client.get(Uri.parse('https://example.com'));
print(response.body);
await client.close();
}
Alternatives
Packages that do the same job and could replace http_client.
Works with
Packages commonly used together with http_client: ones it builds on, ones built on it, and its own family.
- bufferhttp_client depends on itUtilities and classes for reading and writing byte buffers and binary data streams.
- executorhttp_client depends on itExecutes async tasks with a configurable maximum concurrency and rate.
- postgresSame familyPostgreSQL driver for Dart supporting binary protocol, pooling and statement reuse.
- elastic_clientBuilt on http_clientDart bindings for the ElasticSearch HTTP API.