fire_http 0.0.10 fire_http: ^0.0.10 copied to clipboard
The fire_http is a Firestrarter plugin who helps you to implement client of HTTP/1.1 or HTTP/2 on Flutter Project.
A Firestrarter plugin who helps you to implement client of HTTP/1.1 or HTTP/2 on Flutter Project.
Features #
With this plugin, you can easily to use HTTP client with HTTP/1.1 or HTTP/2.
Using #
The easiest way to use this library is through the top-level functions. This is the sample to use it:
import 'dart:async';
import 'package:fire_http/fire_http.dart';
// the path of request
final path = Uri.parse('https://catfact.ninja/fact');
// create HttpClient with HTTP/1.1
final BaseHttpClient client1 = Http1Client();
// create HttpClient with HTTP/2
final BaseHttpClient client2 = Http2Client();
// request with HTTP/1.1 Client
final resClient1 = await client1.get(path);
// request with HTTP/2 Client
final resClient2 = await client2.get(path);
// print all responses
print('\n====== FIRE HTTP =====\n');
print('=> response Client1: \n${resClient1.body}\n');
print('=> response Client2: \n${resClient2.body}');
Additional information #
This Library is provide to set the certificate by [setSecurityContext()
] function, set the proxy by [setProxy()
] function, and set callback when the certificate is error by [onBadCertificate()
] function.