如何为基于 api 调用构建的表单编写小部件测试,直到显示循环进度指示器,我可以编写它,但是如果 API 调用返回 null,如果 API 返回正确的响应,它就可以工作并在 setState() 中为表单设置了呈现 UI 的值,小部件测试失败。我该如何克服这种情况。
Use
await tester.pumpAndSettle(Duration(seconds: x));
followed by your widget test
x
= approx sec to get response from api
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.