import 'package:shared_preferences/shared_preferences.dart'; class SessionManager { static final SessionManager _instance = SessionManager._(); static const String _loggedInKey = 'loggedIn'; factory SessionManager() { return _instance; } SessionManager._(); Future setLoggedIn(bool value) async { final prefs = await SharedPreferences.getInstance(); await prefs.setBool(_loggedInKey, value); } Future isLoggedIn() async { final prefs = await SharedPreferences.getInstance(); return prefs.getBool(_loggedInKey) ?? false; } Future clearSession() async { final prefs = await SharedPreferences.getInstance(); await prefs.clear(); } Future logoutSession(bool value) async { final prefs = await SharedPreferences.getInstance(); await prefs.setBool("isloggedin", value); } }