Future 异步,timeOut的使用。
Flutter 中TimeOut的实现:
Future<Null> _handlerRefresh() async {
await Future.delayed(Duration(sedonds: 2)); // 暂停两秒。
return null; // 让RefreshIndicator从刷新状态,变成非刷新状态。
}
// RefreshIndicator 一般配合列表ListView使用。
RefreshIndicator(
onRefresh: _handlerRefresh, child: ListView(),
)