import 'package:shared_preferences/shared_preferences.dart'; class LocalPref extends Pref { @override Future saveString(String key, String value) async { final prefs = await SharedPreferences.getInstance(); return prefs.setString(key, value); } @override Future getString(String key) async { final prefs = await SharedPreferences.getInstance(); return prefs.getString(key); } } class MemoryPref extends Pref { Map memoryMap = new Map(); @override Future getString(String key) { return Future.value(memoryMap[key]); } @override Future saveString(String key, String value) async { memoryMap[key] = value; return Future.value(true); } } abstract class Pref { Future saveString(String key, String value); Future getString(String key); } class DATA_CONST { static const String TOKEN_KEY = "TOKEN_KEY"; static const String EXPIRED_TIME = "EXPIRED_TIME"; static const String SHRIMP_LITER = "SHRIMP_LITER"; static const String SHRIMP_POND_ID = "SHRIMP_POND_ID"; static const String PUSH_KEY = "PUSH_KEY"; }