import 'package:shared_preferences/shared_preferences.dart'; abstract class UserLocalDataSource { Future cacheUserToken(String token); Future getCachedUserToken(); Future clearCache(); Future cacheEmployeeId(String id); Future getCachedEmployeeId(); Future cacheFullName(String name); Future getCachedFullName(); } class UserLocalDataSourceImpl implements UserLocalDataSource { final SharedPreferences sharedPreferences; static const String _tokenKey = 'user_token'; static const String _employeeIdKey = 'employee_id'; static const String _fullNameKey = 'full_name'; UserLocalDataSourceImpl({required this.sharedPreferences}); @override Future cacheUserToken(String token) async { await sharedPreferences.setString(_tokenKey, token); } @override Future getCachedUserToken() async { return sharedPreferences.getString(_tokenKey); } @override Future cacheFullName(String name) async { await sharedPreferences.setString(_fullNameKey, name); } @override Future getCachedFullName() async { return sharedPreferences.getString(_fullNameKey); } @override Future cacheEmployeeId(String id) async { await sharedPreferences.setString(_employeeIdKey, id); } @override Future getCachedEmployeeId() async { return sharedPreferences.getString(_employeeIdKey); } @override Future clearCache() async { await sharedPreferences.remove(_tokenKey); await sharedPreferences.remove(_employeeIdKey); await sharedPreferences.remove(_fullNameKey); } }