EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

dart null list

減少null判斷情況

https://stackoverflow.com/questions/51036758/flutter-the-method-map-was-called-on-null
https://juejin.im/post/5c6d38b1f265da2dcc7feb69
https://cloud.tencent.com/developer/article/1370380

?? => if null

https://blog.csdn.net/ffa_ijj/article/details/85051156


return qres?.map((value) {
  LinkedHashMap result = json.decode(value["jsonitem"]);
  return result;
})?.first ?? new LinkedHashMap();

這個判斷方式有個問題,當查詢回來為[],不是null情況下,在.first會出錯,因為 "No element"會出錯,但.toList()會正確,故改回


if (qres == null || qres.isEmpty) return new Member(); // 待確定是否出錯

var resmap = qres.first;
return new Member.fromJson(json.decode(resmap["jsonitem"]));