mounted check

This commit is contained in:
Fabian Freund
2025-10-02 13:55:15 +02:00
parent ae49d0f937
commit 21319880d7
2 changed files with 13 additions and 49 deletions
+2 -38
View File
@@ -346,6 +346,7 @@ class GenericWebsiteService extends _$GenericWebsiteService {
return cachedIcon; return cachedIcon;
} }
if (ref.mounted) {
// ignore: only_use_keep_alive_inside_keep_alive // ignore: only_use_keep_alive_inside_keep_alive
final result = await ref.read( final result = await ref.read(
pageInfoProvider(url, isImageRequest: true).future, pageInfoProvider(url, isImageRequest: true).future,
@@ -360,45 +361,8 @@ class GenericWebsiteService extends _$GenericWebsiteService {
return favicon; return favicon;
} }
} }
}
return null; return null;
} }
// Future<Uri?> tryUpgradeToHttps(Uri httpUri) async {
// if (httpUri.isScheme('https')) {
// return httpUri;
// } else if (httpUri.isScheme('http')) {
// final cached = _httpsCache[httpUri.host];
// if (cached != null) {
// return cached ? httpUri.replace(scheme: 'https') : null;
// }
// var sslAvailable = false;
// try {
// final context = SecurityContext.defaultContext;
// final socket = await SecureSocket.connect(
// httpUri.host,
// 443,
// context: context,
// timeout: const Duration(seconds: 3),
// );
// await socket.close();
// sslAvailable = true;
// } catch (_) {
// sslAvailable = false;
// }
// _httpsCache[httpUri.host] = sslAvailable;
// if (sslAvailable) {
// return httpUri.replace(scheme: 'https');
// }
// }
// return null;
// }
} }
@@ -42,7 +42,7 @@ final class GenericWebsiteServiceProvider
} }
String _$genericWebsiteServiceHash() => String _$genericWebsiteServiceHash() =>
r'c20897405a4d31983a22d61e955ffb7430d06a54'; r'9bc32261abd76a79efb57f6d27832e949cb495a6';
abstract class _$GenericWebsiteService extends $Notifier<void> { abstract class _$GenericWebsiteService extends $Notifier<void> {
void build(); void build();