import 'package:shared_preferences/shared_preferences.dart'; abstract class UserLocalDataSource { Future cacheUserToken(String token); Future getCachedUserToken(); Future clearCache(); } class UserLocalDataSourceImpl implements UserLocalDataSource { final SharedPreferences sharedPreferences; static const String _tokenKey = 'user_token'; 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 clearCache() async { await sharedPreferences.remove(_tokenKey); } }