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.
example/main.dart
// ignore_for_file: avoid_print
import 'dart:async';
import 'package:fire_http/fire_http.dart';
Future<void> main(List<String> arguments) async {
// 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}');
}