FLUTTER ECOSYSTEM

fluttercandies/http_client_helper

Ein Flutter-Plugin für HTTP-Anfragen mit Abbruch- und Wiederholungsfunktionen.

Projektcover von http_client_helper
Stars
28
Forks
12
Letzter Push (UTC)
24.06.2024
Projektstatus
Aktiv
FlutterCandies GitHub avatar
GITHUB Organization

FlutterCandies ↗

Custom Flutter candies (packages) for you to build your Flutter app easily. Enjoy it!

SprachenDartObjective-CJava

Technische Themen

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 1 Einträge

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

Projekt-README ein-/ausklappen

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.