format code

This commit is contained in:
jyuesong
2022-01-18 09:29:45 +08:00
parent 917425c5de
commit 074580952f
40 changed files with 414 additions and 568 deletions

View File

@@ -56,7 +56,8 @@ class SpUtil {
}
/// get obj list.
static List<T>? getObjList<T>(String key, T f(Map v), {List<T> defValue = const []}) {
static List<T>? getObjList<T>(String key, T f(Map v),
{List<T> defValue = const []}) {
List<Map>? dataList = getObjectList(key);
List<T>? list = dataList?.map((value) {
return f(value);
@@ -123,7 +124,8 @@ class SpUtil {
}
/// get string list.
static List<String> getStringList(String key, {List<String> defValue = const []}) {
static List<String> getStringList(String key,
{List<String> defValue = const []}) {
if (_prefs == null) return defValue;
return _prefs!.getStringList(key) ?? defValue;
}
@@ -168,4 +170,4 @@ class SpUtil {
static bool isInitialized() {
return _prefs != null;
}
}
}