Flutter 報(bào)錯(cuò) Expected a value of type 'List<String>', but got one of type 'List<dynamic>'
服務(wù)端返回的數(shù)據(jù)是List<dynamic> callback給業(yè)務(wù)的時(shí)候想返回一個(gè)List<String>類型的
解決方法如下
var hotwords = (response["hotwords"] as List)
?.map((item) => item as String)
?.toList();
需要的老鐵可以拿去用