initialized Application theme

This commit is contained in:
Mohammad Salameh
2024-02-15 14:00:09 +03:00
parent 16f47f744c
commit 3190361901
98 changed files with 871 additions and 1004 deletions

View File

@ -0,0 +1,31 @@
import 'package:shared_preferences/shared_preferences.dart';
class CacheHelper {
static late SharedPreferences sharedPreferences;
static init() async {
sharedPreferences = await SharedPreferences.getInstance();
}
static Object? getData({
required String key,
}) async {
return sharedPreferences.get(key);
}
static Future setData({
required String key,
required value,
}) async {
if (value is String) return await sharedPreferences.setString(key, value);
if (value is int) return await sharedPreferences.setInt(key, value);
if (value is bool) return await sharedPreferences.setBool(key, value);
return await sharedPreferences.setDouble(key, value);
}
static dynamic removeData({
required String key,
}) async {
return sharedPreferences.remove(key);
}
}