Skip to content
pubscout

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

WASM-ready
$ flutter pub add http_client
Source repository

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.

  • dio

    Feature‑rich client with interceptors, transformers, and advanced request handling

Works with

Packages commonly used together with http_client: ones it builds on, ones built on it, and its own family.