Flutter報錯The argument type 'Future< String>' can't be assigned to the parameter type 'String'.

返回值的類型錯誤,解決辦法主要有兩種,第一種使用async和await,第二種時直接使用futures, 第一種示例web Future<Void> printDailyNewsDigest() async { String news = await gatherNewsReports(); print(news); } 第二種只須要指定回調,在回調中進行處理async void prin
相關文章
相關標籤/搜索