feat: add secure storage to store user key

This commit is contained in:
ZhuJHua
2025-02-06 18:51:07 +08:00
parent 545891fe55
commit 6ce64f8b46
10 changed files with 118 additions and 42 deletions

View File

@@ -0,0 +1,21 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class SecureStorageUtil {
static const _storage = FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true,
),
);
static Future<void> setValue(String key, dynamic value) async {
await _storage.write(key: key, value: value);
}
static Future<String?> getValue(String key) async {
return await _storage.read(key: key);
}
static Future<void> remove(String key) async {
await _storage.delete(key: key);
}
}