mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
27 lines
1.1 KiB
Dart
27 lines
1.1 KiB
Dart
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
abstract class KVStoreService {
|
|
static SharedPreferences? _sharedPreferences;
|
|
static SharedPreferences get sharedPreferences => _sharedPreferences!;
|
|
|
|
static Future<void> initialize() async {
|
|
_sharedPreferences = await SharedPreferences.getInstance();
|
|
}
|
|
|
|
static bool get doneGettingStarted =>
|
|
sharedPreferences.getBool('doneGettingStarted') ?? false;
|
|
static Future<void> setDoneGettingStarted(bool value) async =>
|
|
await sharedPreferences.setBool('doneGettingStarted', value);
|
|
|
|
static bool get askedForBatteryOptimization =>
|
|
sharedPreferences.getBool('askedForBatteryOptimization') ?? false;
|
|
static Future<void> setAskedForBatteryOptimization(bool value) async =>
|
|
await sharedPreferences.setBool('askedForBatteryOptimization', value);
|
|
|
|
static List<String> get recentSearches =>
|
|
sharedPreferences.getStringList('recentSearches') ?? [];
|
|
|
|
static Future<void> setRecentSearches(List<String> value) async =>
|
|
await sharedPreferences.setStringList('recentSearches', value);
|
|
}
|