feat:增加服务器接口模块
This commit is contained in:
23
lib/utils/SpUtil.dart
Normal file
23
lib/utils/SpUtil.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class SpUtil {
|
||||
static late SharedPreferences _sp;
|
||||
|
||||
static Future<void> init() async {
|
||||
_sp = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
static Future<bool> setString(String key, String value) =>
|
||||
_sp.setString(key, value);
|
||||
|
||||
static String? getString(String key) => _sp.getString(key);
|
||||
|
||||
static Future<bool> setInt(String key, int value) =>
|
||||
_sp.setInt(key, value);
|
||||
|
||||
static int? getInt(String key) => _sp.getInt(key);
|
||||
|
||||
static Future<bool> remove(String key) => _sp.remove(key);
|
||||
|
||||
static Future<bool> clear() => _sp.clear();
|
||||
}
|
||||
Reference in New Issue
Block a user