https://github.com/jaydaraniya/persist_http
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.
https://github.com/jaydaraniya/persist_http
dart flutter http
Last synced: about 1 month ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/jaydaraniya/persist_http
- Owner: JAYDARANIYA
- License: mit
- Created: 2023-12-11T03:43:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-18T05:29:17.000Z (about 2 years ago)
- Last Synced: 2026-02-16T01:23:15.254Z (about 2 months ago)
- Topics: dart, flutter, http
- Language: Dart
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# persist_http
[](https://pub.dev/packages/persist_http)
[](https://opensource.org/licenses/MIT)
[](https://github.com/JAYDARANIYA/persist_http/issues?q=is%3Aissue+is%3Aopen+)
[](https://github.com/JAYDARANIYA/persist_http/pulls)
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.
## Installation
``` yaml
dependencies:
persist_http: ^0.0.1-beta
```
## Example
```dart
import 'package:flutter/foundation.dart';
import 'package:persist_http/persist_http.dart';
void main() async {
await connectionsCheck();
await multiCallWithPersistConnection();
}
Future connectionsCheck() async {
var client = PresistHttp("example.com");
await client.connect();
await client.close();
}
Future 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();
}
```