refactor(token): add token storage, remove hive

This commit is contained in:
mso7nueh
2024-08-26 15:04:07 +03:00
parent 603728549d
commit cea81abd21
29 changed files with 98 additions and 271 deletions

View File

@@ -1,34 +0,0 @@
import 'package:shared_preferences/shared_preferences.dart';
class PrefUtils {
static SharedPreferences? _sharedPreferences;
PrefUtils() {
// init();
SharedPreferences.getInstance().then((value) {
_sharedPreferences = value;
});
}
Future<void> init() async {
_sharedPreferences ??= await SharedPreferences.getInstance();
print('SharedPreference Initialized');
}
///will clear all the data stored in preference
void clearPreferencesData() async {
_sharedPreferences!.clear();
}
Future<void> setThemeData(String value) {
return _sharedPreferences!.setString('themeData', value);
}
String getThemeData() {
try {
return _sharedPreferences!.getString('themeData')!;
} catch (e) {
return 'primary';
}
}
}