错误: type 'Null' is not a subtype of type 'List<int>' in type cast

解决方案:使用异步方法,延迟刷新页面
解决效果图:

关键代码:
body: RefreshIndicator(
child: Image.network(
"http://www.devio.org/img/avatar.png",
width: 50,
height: 50,
),
//_asyncRefresh用于实现屏幕下拉时的回调函数
onRefresh: _asyncRefresh),
Future<Null> _asyncRefresh() async {
await Future.delayed(Duration(milliseconds: 200));
return null;
}
完整代

在使用Flutter的Image.network加载网络图片时遇到类型错误:'Null' is not a subtype of type 'List<int>'。解决方案是采用异步方法,延迟刷新页面以确保数据加载完成。关键代码涉及异步加载和列表转换。
最低0.47元/天 解锁文章
1118

被折叠的 条评论
为什么被折叠?



