downgrade flutter_secure_storage, safer async ops

potential fix for #484
This commit is contained in:
Tommy Chow 2026-01-02 15:28:26 -05:00
parent ef846a4596
commit ba28e09e58
3 changed files with 38 additions and 22 deletions

View file

@ -54,11 +54,16 @@ void main() async {
// Workaround for clearing stored tokens on uninstall. // Workaround for clearing stored tokens on uninstall.
// If first time running app, will clear all tokens in the secure storage. // If first time running app, will clear all tokens in the secure storage.
// Run non-blocking to avoid ANR on slow Android devices (especially Android 14).
if (firstRun) { if (firstRun) {
debugPrint('Clearing secure storage...'); debugPrint('Clearing secure storage...');
const storage = FlutterSecureStorage(); const storage = FlutterSecureStorage();
await storage.deleteAll(); // Don't block - run in background after app starts.
// This is safe because first run means no active session depends on this data.
unawaited(storage.deleteAll().catchError((e) {
debugPrint('Error clearing secure storage: $e');
}));
} }
await initUtils(); await initUtils();
@ -183,8 +188,11 @@ class _MyAppState extends State<MyApp> {
handleDeepLink(uri); handleDeepLink(uri);
}); });
// Handle the initial link if app was opened from a link // Handle the initial link if app was opened from a link.
final initialLink = await _appLinks.getInitialLink(); // Add timeout to prevent indefinite blocking on certain Android lifecycle states.
final initialLink = await _appLinks
.getInitialLink()
.timeout(const Duration(seconds: 3), onTimeout: () => null);
if (initialLink != null) { if (initialLink != null) {
handleDeepLink(initialLink); handleDeepLink(initialLink);
} }

View file

@ -490,50 +490,50 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_secure_storage name: flutter_secure_storage
sha256: da922f2aab2d733db7e011a6bcc4a825b844892d4edd6df83ff156b09a9b2e40 sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.0.0" version: "9.2.4"
flutter_secure_storage_darwin:
dependency: transitive
description:
name: flutter_secure_storage_darwin
sha256: "8878c25136a79def1668c75985e8e193d9d7d095453ec28730da0315dc69aee3"
url: "https://pub.dev"
source: hosted
version: "0.2.0"
flutter_secure_storage_linux: flutter_secure_storage_linux:
dependency: transitive dependency: transitive
description: description:
name: flutter_secure_storage_linux name: flutter_secure_storage_linux
sha256: "2b5c76dce569ab752d55a1cee6a2242bcc11fdba927078fb88c503f150767cda" sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" version: "1.2.3"
flutter_secure_storage_macos:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247"
url: "https://pub.dev"
source: hosted
version: "3.1.3"
flutter_secure_storage_platform_interface: flutter_secure_storage_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: flutter_secure_storage_platform_interface name: flutter_secure_storage_platform_interface
sha256: "8ceea1223bee3c6ac1a22dabd8feefc550e4729b3675de4b5900f55afcb435d6" sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "1.1.2"
flutter_secure_storage_web: flutter_secure_storage_web:
dependency: transitive dependency: transitive
description: description:
name: flutter_secure_storage_web name: flutter_secure_storage_web
sha256: "6a1137df62b84b54261dca582c1c09ea72f4f9a4b2fcee21b025964132d5d0c3" sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "1.2.1"
flutter_secure_storage_windows: flutter_secure_storage_windows:
dependency: transitive dependency: transitive
description: description:
name: flutter_secure_storage_windows name: flutter_secure_storage_windows
sha256: "3b7c8e068875dfd46719ff57c90d8c459c87f2302ed6b00ff006b3c9fcad1613" sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.1.0" version: "3.1.2"
flutter_svg: flutter_svg:
dependency: "direct main" dependency: "direct main"
description: description:
@ -648,6 +648,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
js:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.7"
json_annotation: json_annotation:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -37,7 +37,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
web_socket_channel: ^3.0.0 web_socket_channel: ^3.0.0
flutter_secure_storage: ^10.0.0 flutter_secure_storage: ^9.2.2
intl: ^0.20.1 intl: ^0.20.1
cached_network_image: ^3.1.0 cached_network_image: ^3.1.0
webview_flutter: ^4.2.0 webview_flutter: ^4.2.0