From 44d84ff9e377145769cecf5d025333a78d9e74bc Mon Sep 17 00:00:00 2001 From: Minghao Hu Date: Sun, 13 Aug 2023 00:04:53 +0800 Subject: [PATCH] Initialize nativeHttpClientAdapter to false on unsupported platforms. --- lib/common/service/ehconfig_service.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/common/service/ehconfig_service.dart b/lib/common/service/ehconfig_service.dart index 4227a793f..0cf55c68b 100644 --- a/lib/common/service/ehconfig_service.dart +++ b/lib/common/service/ehconfig_service.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:enum_to_string/enum_to_string.dart'; import 'package:fehviewer/common/controller/webdav_controller.dart'; import 'package:fehviewer/common/service/base_service.dart'; @@ -303,8 +305,12 @@ class EhConfigService extends ProfileService { }); // nativeHttpClientAdapter - nativeHttpClientAdapter = - ehConfig.nativeHttpClientAdapter ?? nativeHttpClientAdapter; + if (Platform.isAndroid || Platform.isIOS || Platform.isMacOS) { + nativeHttpClientAdapter = + ehConfig.nativeHttpClientAdapter ?? nativeHttpClientAdapter; + } else { + nativeHttpClientAdapter = false; + } everProfile(_nativeHttpClientAdapter, (val) { ehConfig = ehConfig.copyWith(nativeHttpClientAdapter: val); });