为 audioplayers_android 模块单独设置 Java 1.8,其他模块保持 Java 17
This commit is contained in:
@@ -13,13 +13,8 @@ class SQLiteStorageController {
|
||||
/// 初始化SharedPreferences
|
||||
static Future<void> init() async {
|
||||
try {
|
||||
print('开始初始化SharedPreferences...');
|
||||
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
|
||||
print('SharedPreferences初始化成功');
|
||||
} catch (e) {
|
||||
print('SharedPreferences初始化失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -37,9 +32,7 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.setString(key, value);
|
||||
print('设置字符串值: $key');
|
||||
} catch (e) {
|
||||
print('设置字符串值失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -52,10 +45,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
final value = instance.getString(key) ?? defaultValue;
|
||||
print('获取字符串值: $key = $value');
|
||||
return value;
|
||||
} catch (e) {
|
||||
print('获取字符串值失败: $e');
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -65,9 +56,7 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.setInt(key, value);
|
||||
print('设置整数值: $key = $value');
|
||||
} catch (e) {
|
||||
print('设置整数值失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -77,10 +66,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
final value = instance.getInt(key) ?? defaultValue;
|
||||
print('获取整数值: $key = $value');
|
||||
return value;
|
||||
} catch (e) {
|
||||
print('获取整数值失败: $e');
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -90,9 +77,7 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.setBool(key, value);
|
||||
print('设置布尔值: $key = $value');
|
||||
} catch (e) {
|
||||
print('设置布尔值失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -102,10 +87,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
final value = instance.getBool(key) ?? defaultValue;
|
||||
print('获取布尔值: $key = $value');
|
||||
return value;
|
||||
} catch (e) {
|
||||
print('获取布尔值失败: $e');
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -115,9 +98,7 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.setDouble(key, value);
|
||||
print('设置双精度值: $key = $value');
|
||||
} catch (e) {
|
||||
print('设置双精度值失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -130,10 +111,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
final value = instance.getDouble(key) ?? defaultValue;
|
||||
print('获取双精度值: $key = $value');
|
||||
return value;
|
||||
} catch (e) {
|
||||
print('获取双精度值失败: $e');
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -143,9 +122,7 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.setStringList(key, value);
|
||||
print('设置字符串列表: $key (数量: ${value.length})');
|
||||
} catch (e) {
|
||||
print('设置字符串列表失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -158,10 +135,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
final value = instance.getStringList(key) ?? defaultValue ?? [];
|
||||
print('获取字符串列表: $key (数量: ${value.length})');
|
||||
return value;
|
||||
} catch (e) {
|
||||
print('获取字符串列表失败: $e');
|
||||
return defaultValue ?? [];
|
||||
}
|
||||
}
|
||||
@@ -171,9 +146,7 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.remove(key);
|
||||
print('移除存储值: $key');
|
||||
} catch (e) {
|
||||
print('移除存储值失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -183,9 +156,7 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.clear();
|
||||
print('清空所有存储');
|
||||
} catch (e) {
|
||||
print('清空存储失败: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -195,10 +166,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
final keys = instance.getKeys();
|
||||
print('获取存储键: ${keys.length}个');
|
||||
return keys;
|
||||
} catch (e) {
|
||||
print('获取存储键失败: $e');
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@@ -208,10 +177,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
final exists = instance.containsKey(key);
|
||||
print('检查键存在: $key = $exists');
|
||||
return exists;
|
||||
} catch (e) {
|
||||
print('检查键存在失败: $e');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -221,9 +188,8 @@ class SQLiteStorageController {
|
||||
try {
|
||||
final instance = await _getInstance();
|
||||
await instance.reload();
|
||||
print('重新加载存储数据');
|
||||
} catch (e) {
|
||||
print('重新加载数据失败: $e');
|
||||
// 忽略错误
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user