class SessionManager { // Private constructor SessionManager._internal(); // Singleton instance static final SessionManager instance = SessionManager._internal(); String? _cookie; Map? _currentUser; // Getter for the current user data Map? get currentUser => _currentUser; /// Starts a session by storing user data. void startSession(Map userData) { _currentUser = userData; } /// Saves the session cookie. void setCookie(String? cookie) { if (cookie != null) { // Extract only the essential part of the cookie to avoid extra attributes _cookie = cookie.split(';').first; } } /// Retrieves the saved session cookie. String? getCookie() { return _cookie; } /// Clears all session data. void clearSession() { _cookie = null; _currentUser = null; } }