[英]Flutter:Testing the widget with circular progress indicator and api call using Dio
如何為基於 api 調用構建的表單編寫小部件測試,直到顯示循環進度指示器,我可以編寫它,但是如果 API 調用返回 null,如果 API 返回正確的響應,它就可以工作並在 setState() 中為表單設置了呈現 UI 的值,小部件測試失敗。我該如何克服這種情況。
用
await tester.pumpAndSettle(Duration(seconds: x));
其次是您的小部件測試
x
= 大約 sec 從 api 得到響應
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.