putObjectList method
存储对象列表
Implementation
Future<bool> putObjectList(String key, List<Object> list) async {
await ensureInitialized();
try {
final List<String> encodedList = list
.map(
(e) => jsonUtil.encodeObj(e),
)
.where((e) => e != null)
.cast<String>()
.toList();
return _prefs?.setStringList(key, encodedList) ?? false;
} catch (e) {
logger.e("SpUtil error putObjectList list for key '$key ,list:$list\n error:$e");
return false;
}
}