mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Surface persistence and fetch errors instead of swallowing them
PrefUtil.setValue now returns the underlying SharedPreferences result and throws on unsupported types; settings save reports failures rather than always showing success. Device detail and event history report the real Dio error message and skip cancellations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
f7f255e20f
commit
e70676a193
@@ -10,15 +10,18 @@ class PrefUtil {
|
||||
return preferences;
|
||||
}
|
||||
|
||||
static void setValue(String key, Object value) {
|
||||
static Future<bool> setValue(String key, Object value) {
|
||||
switch (value) {
|
||||
case String s:
|
||||
preferences.setString(key, s);
|
||||
return preferences.setString(key, s);
|
||||
case bool b:
|
||||
preferences.setBool(key, b);
|
||||
return preferences.setBool(key, b);
|
||||
case int i:
|
||||
preferences.setInt(key, i);
|
||||
return preferences.setInt(key, i);
|
||||
default:
|
||||
throw ArgumentError(
|
||||
'Unsupported pref value type: ${value.runtimeType}',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user