http_client_helper
3.0.0, released 3 years ago by fluttercandies.com
A Flutter plugin for HTTP requests with cancellation and retry functions.
WASM-ready
What it does
Provides helper functions for performing HTTP requests with built-in support for request cancellation using a CancellationToken, retries, and time limits. It acts as an extension wrapper around the standard http package.
AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need simple HTTP requests with built-in retry mechanisms and cancellation support.
- You want to add timeouts and cancellation tokens to basic http operations.
Skip it when
- You need advanced networking features like interceptors, global transformers, or multipart uploading out of the box (use dio instead).
- You require complex API abstractions (use retrofit).
- You are working with GraphQL or WebSockets.
Strengths
- Supports cancellation tokens out of the box.
- Easy to configure retries and timeouts for HTTP requests.
- Compatible across Android, iOS, web, Windows, macOS, and Linux.
Weaknesses
- Limited feature set compared to fully-featured HTTP clients like dio.
- Relies on basic wrapper logic around the core http package.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
not documented
cancellationToken = new CancellationToken();
try {
await HttpClientHelper.get(url,
cancelToken: cancellationToken,
timeRetry: Duration(milliseconds: 100),
retries: 3,
timeLimit: Duration(seconds: 5))
.then((response) {
setState(() {
msg = response.body;
});
});
} on TimeoutException catch (_) {
setState(() {
msg = "TimeoutException";
});
} on OperationCanceledError catch (_) {
setState(() {
msg = "cancel";
});
} catch (e) {
setState(() {
msg = "$e";
});
}Alternatives
Packages that do the same job and could replace http_client_helper.
Works with
Packages commonly used together with http_client_helper: ones it builds on, ones built on it, and its own family.