import 'package:shared_preferences/shared_preferences.dart'; class CustomSharedPreferences { static const String key1 = 'value1'; static const String key2 = 'value2'; static const String key3 = 'value3'; static const String key4 = 'value4'; static const String key5 = 'value5'; // Method to save a string value to shared preferences static Future setCustomValue(String value) async { final prefs = await SharedPreferences.getInstance(); prefs.setString(key1, value); } static Future setname(String value) async { final prefs = await SharedPreferences.getInstance(); prefs.setString(key2, value); } static Future setuserid(String value) async { final prefs = await SharedPreferences.getInstance(); prefs.setString(key3, value); } static Future setusername(String value) async { final prefs = await SharedPreferences.getInstance(); prefs.setString(key4, value); } static Future setsynctime(String value) async { final prefs = await SharedPreferences.getInstance(); prefs.setString(key5, value); } // Method to retrieve a string value from shared preferences static Future getCustomValue() async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(key1); } static Future getname() async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(key2); } static Future getuserid() async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(key3); } static Future getusername() async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(key4); } static Future getsynctime() async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(key5); } static Future clearAllValues() async { final prefs = await SharedPreferences.getInstance(); await prefs.remove(key1); await prefs.remove(key2); await prefs.remove(key3); await prefs.remove(key4); await prefs.remove(key5); } }