persist_http 0.0.2-beta copy "persist_http: ^0.0.2-beta" to clipboard
persist_http: ^0.0.2-beta copied to clipboard

This library provides an efficient way to handle HTTP requests by reusing the same HTTP handshake. It's designed for Dart environments and supports all platforms except Flutter Web due to the use of dart:io.

example/example.dart

import 'package:flutter/foundation.dart';
import 'package:persist_http/persist_http.dart';

void main() async {
  await connectionsCheck();
  await multiCallWithPersistConnection();
}

Future<void> connectionsCheck() async {
  var client = PresistHttp("example.com");
  await client.connect();
  await client.close();
}

Future<void> multiCallWithPersistConnection() async {
  final persistHttp = PresistHttp('randomuser.me');
  await persistHttp.connect();

  for (var i = 0; i < 10; i++) {
    final response = await persistHttp.get('/api');
    debugPrint(response);
  }

  await persistHttp.close();
}
2
likes
150
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

This library provides an efficient way to handle HTTP requests by reusing the same HTTP handshake. It's designed for Dart environments and supports all platforms except Flutter Web due to the use of dart:io.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on persist_http