Initial commit
This commit is contained in:
61
lib/utils/preferences.dart
Normal file
61
lib/utils/preferences.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class Preferences {
|
||||
static const languageCodeKey = "languageCodeKey";
|
||||
static const isFinishOnBoardingKey = "isFinishOnBoardingKey";
|
||||
static const foodDeliveryType = "foodDeliveryType";
|
||||
static const themKey = "themKey";
|
||||
|
||||
static const payFastSettings = "payFastSettings";
|
||||
static const mercadoPago = "MercadoPago";
|
||||
static const paypalSettings = "paypalSettings";
|
||||
static const stripeSettings = "stripeSettings";
|
||||
static const flutterWave = "flutterWave";
|
||||
static const payStack = "payStack";
|
||||
static const paytmSettings = "PaytmSettings";
|
||||
static const walletSettings = "walletSettings";
|
||||
static const razorpaySettings = "razorpaySettings";
|
||||
static const midTransSettings = "midTransSettings";
|
||||
static const orangeMoneySettings = "orangeMoneySettings";
|
||||
static const xenditSettings = "xenditSettings";
|
||||
static const codSettings = "CODSettings";
|
||||
static const orderRingtone = "audioSound";
|
||||
|
||||
static late SharedPreferences pref;
|
||||
|
||||
static Future<void> initPref() async {
|
||||
pref = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
static bool getBoolean(String key) {
|
||||
return pref.getBool(key) ?? false;
|
||||
}
|
||||
|
||||
static Future<void> setBoolean(String key, bool value) async {
|
||||
await pref.setBool(key, value);
|
||||
}
|
||||
|
||||
static String getString(String key, {String? defaultValue}) {
|
||||
return pref.getString(key) ?? defaultValue ?? "";
|
||||
}
|
||||
|
||||
static Future<void> setString(String key, String value) async {
|
||||
await pref.setString(key, value);
|
||||
}
|
||||
|
||||
static int getInt(String key) {
|
||||
return pref.getInt(key) ?? 0;
|
||||
}
|
||||
|
||||
static Future<void> setInt(String key, int value) async {
|
||||
await pref.setInt(key, value);
|
||||
}
|
||||
|
||||
static Future<void> clearSharPreference() async {
|
||||
await pref.clear();
|
||||
}
|
||||
|
||||
static Future<void> clearKeyData(String key) async {
|
||||
await pref.remove(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user