mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-06-01 17:15:48 +08:00
14 lines
451 B
Dart
14 lines
451 B
Dart
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
class LocalStorage {
|
|
static Future<bool?> getBool(String key, {bool? defaultValue}) async {
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
return prefs.getBool(key) ?? defaultValue;
|
|
}
|
|
|
|
static Future<void> setBool(String key, bool value) async {
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
await prefs.setBool(key, value);
|
|
}
|
|
}
|