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
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.
Works with
Packages commonly used together with mercury_client: ones it builds on, ones built on it, and its own family.
- webmercury_client depends on itLightweight bindings for browser APIs via JS interop
- charsetmercury_client depends on itCharset encoding and decoding library for various text encodings in Dart.
- swiss_knifemercury_client depends on itCollection of Dart utility tools for collections, math, date, URI, JSON, events, and resources.
- bones_apiBuilt on mercury_clientA powerful API backend framework for Dart with HTTP server, routing, SQL translator, and DB adapters.
- docker_commanderBuilt on mercury_clientDocker manager for local and remote host machines to automate Docker Daemons and Swarms.
- bones_uiBuilt on mercury_clientAn intuitive and user-friendly Web User Interface framework for Dart.
- release_updaterBuilt on mercury_clientAutomatically update release and installation files in a local directory.