import 'package:shared_preferences/shared_preferences.dart';


class SecureStorageService {
  static Future<String?> get(String key) async {
    final prefs = await SharedPreferences.getInstance();
    return prefs.getString(key);
  }

  static Future<void> _setImp(SharedPreferences prefs, String key, String value) async {
    await prefs.setString(key, value);
  }

  static Future<void> set(String key, String? value) async {
    final prefs = await SharedPreferences.getInstance();
    if (value == null) {
      return delete(key);  
    }
    return _setImp(prefs, key, value);
  }

  static Future<bool> containsKey(String key) async {
    final prefs = await SharedPreferences.getInstance();
    return prefs.containsKey(key);
  }

  static Future<void> delete(String key) async {
    final prefs = await SharedPreferences.getInstance();
    await prefs.remove(key);
  }
}
