6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 75bba4b8

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-05-15 10:08:12 +0200
Removed shared preferences package and used flutter secure storage instead

Changed files

comwell_key_app/lib/utils/secure_storage.dart | 8 +++-----
 comwell_key_app/pubspec.yaml                  | 1 -
 2 files changed, 3 insertions(+), 6 deletions(-)

Diff

diff --git a/comwell_key_app/lib/utils/secure_storage.dart b/comwell_key_app/lib/utils/secure_storage.dart
index 5083125e..be65bc70 100644
--- a/comwell_key_app/lib/utils/secure_storage.dart
+++ b/comwell_key_app/lib/utils/secure_storage.dart
@@ -1,5 +1,4 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
-import 'package:shared_preferences/shared_preferences.dart';
class SecureStorage {
final FlutterSecureStorage _storage = const FlutterSecureStorage();
@@ -17,12 +16,11 @@ class SecureStorage {
}
Future<void> clearKeychainValues() async {
- final prefs = await SharedPreferences.getInstance();
+ final isFirstLaunch = await _storage.read(key: 'is_first_app_launch');
- if (prefs.getBool('is_first_app_launch') ?? true) {
+ if (isFirstLaunch == null || isFirstLaunch == 'true') {
await _storage.deleteAll();
-
- await prefs.setBool('is_first_app_launch', false);
+ await _storage.write(key: 'is_first_app_launch', value: 'false');
}
}
diff --git a/comwell_key_app/pubspec.yaml b/comwell_key_app/pubspec.yaml
index 826ec57c..71246a0e 100644
--- a/comwell_key_app/pubspec.yaml
+++ b/comwell_key_app/pubspec.yaml
@@ -54,7 +54,6 @@ dependencies:
package_info_plus: ^8.3.0
sentry_flutter: ^8.13.0
share_plus: ^10.1.4
- shared_preferences: ^2.5.3
dependency_overrides:
#Remove override when slider button updates