Flutter Native HTTP Client
import 'package:cronet_http/cronet_http.dart';
import 'package:cupertino_http/cupertino_http.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:platform_info/platform_info.dart';
void main() async {
var clientFactory = Client.new;
final device = DeviceInfoPlugin();
if (platform.isAndroid) {
final engine = CronetEngine.build(
cacheMode: CacheMode.memory,
userAgent: (await device.androidInfo).model,
);
clientFactory = () => CronetClient.fromCronetEngine(engine);
} else if (platform.isCupertino) {
clientFactory = CupertinoClient.defaultSessionConfiguration.call;
}
runWithClient(() => runApp(const MyApp()),clientFactory);
}