feat: use win_http on Windows
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:cronet_http/cronet_http.dart';
|
||||
import 'package:cupertino_http/cupertino_http.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/io_client.dart';
|
||||
import 'package:win_http/win_http.dart';
|
||||
|
||||
/// Shared Cronet engine so all clients reuse the same connection pool.
|
||||
CronetEngine? _sharedEngine;
|
||||
@@ -21,5 +22,8 @@ http.Client createPlatformClient() {
|
||||
if (Platform.isIOS || Platform.isMacOS) {
|
||||
return CupertinoClient.defaultSessionConfiguration();
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return WinHttpClient.defaultConfiguration();
|
||||
}
|
||||
return IOClient();
|
||||
}
|
||||
|
||||
@@ -1475,6 +1475,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
win_http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: win_http
|
||||
sha256: f5da1c955a39822f4287fd2ddaef9b878542d382d023a482b207647bf945023b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
window_manager:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -65,6 +65,7 @@ dependencies:
|
||||
ref: 9e150f7
|
||||
cupertino_http: ^2.4.0
|
||||
cronet_http: ^1.6.0
|
||||
win_http: ^0.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user