Skip to content
pubscout

mercury_client

2.4.1, released 2 weeks ago by an unverified publisher

Portable HTTP client with browser and native support and memory cache

WASM-ready
$ flutter pub add mercury_client
Source repository

What it does

Provides a portable HTTP client supporting GET, HEAD, POST, PUT, DELETE, PATCH, and OPTIONS methods for both browser and native environments. Includes built-in memory caching capabilities with timeout and stale response handling.

AI-written summary of version 2.4.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a single HTTP client implementation that works seamlessly on both browser and native platforms.
  • You require built-in in-memory caching with stale response callbacks for HTTP requests.

Skip it when

  • You need advanced networking features like interceptors, global transformers, or multipart form uploads provided by more extensive ecosystem clients like dio.

Strengths

  • Portable across browser and native platforms
  • Built-in memory cache with stale response notification support
  • Supports standard HTTP methods

Weaknesses

  • Limited feature set compared to larger HTTP libraries like dio
  • Fewer community resources and plugins

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
5
import 'package:mercury_client/mercury_client.dart';

main() async {
  var client = HttpClient('http://gateway.your.domain/api-1');

  try {
    var response = await client.post(
      'call-foo',
      parameters: {'var': '123'},
      body: "{ 'content': 'any' }",
      contentType: 'application/json',
    );

    if (response.isOK) {
      print(response.body);
    }
  } catch (e) {
    print('Error requesting URL: $e');
  }
}

Alternatives

Packages that do the same job and could replace mercury_client.

  • http

    Choose http for a standard, widely-used, lightweight multi-platform package maintained by the Dart team.

  • dio

    Choose dio if you need advanced features like interceptors, global configuration, cancellation tokens, and robust FormData support.

Works with

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