Search categories, packages and repositories

Package detailsv3.0.0

http_client_helper

A Flutter plugin for http request with cancel and retry fuctions.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
416K
Likes
32
Pub points
160

Install package

flutter pub add http_client_helper

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package designed to simplify HTTP requests with built-in support for cancellation and retry mechanisms. It enhances network operations by providing a clean, reusable interface for making HTTP calls across multiple platforms including Android, iOS, Web, macOS, Windows, and Linux. The package helps manage request lifecycles efficiently, reducing boilerplate code and improving reliability during network fluctuations. Ideal for apps requiring robust and responsive API interactions.

Use cases

  • Handling API calls with automatic retries
  • Managing concurrent requests with cancellation
  • Improving app responsiveness during network delays
  • Building reliable data fetching layers
  • Simplifying error handling in HTTP operations

Key features

  • Built-in request cancellation
  • Automatic retry logic
  • Cross-platform compatibility
  • Simple API integration
  • Support for various HTTP methods
  • Configurable retry strategies

Suitable for

  • Apps with frequent network requests
  • Developers seeking reliable HTTP handling
  • Projects requiring request lifecycle management
  • Teams prioritizing maintainable network code
  • Applications needing resilience against network instability

Considerations

  • Requires understanding of async/await patterns
  • May need additional configuration for complex retry rules
  • Not suitable for very lightweight HTTP needs
  • Depends on underlying http package
  • Limited to HTTP-specific use cases

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

http_client_helper

pub package

A Flutter plugin for http request with cancel and retry fuctions.

Usage

To use this plugin, add http_client_helper as a dependency in your pubspec.yaml file.

Example
  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";
        });
      }

Please see the example app of this plugin for a full example.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package