import 'package:flutter_secure_storage/flutter_secure_storage.dart'; class SecureStore { SecureStore._(); static const _storage = FlutterSecureStorage( aOptions: AndroidOptions( encryptedSharedPreferences: true, ), iOptions: IOSOptions( accessibility: KeychainAccessibility.first_unlock, ), ); // String static Future write(String key, String value) => _storage.write(key: key, value: value); static Future read(String key) => _storage.read(key: key); static Future delete(String key) => _storage.delete(key: key); static Future deleteAll() => _storage.deleteAll(); // Bool static Future writeBool(String key, bool value) => write(key, value ? '1' : '0'); static Future readBool(String key, {bool defaultValue = false}) async { final v = await read(key); if (v == null) return defaultValue; return v == '1' || v.toLowerCase() == 'true'; } }