我正在使用网页浏览构建器,但无法遍历页面。我不断收到此错误:
“方法 'animateToPage' 在 null 上调用。接收方:null 尝试调用:animateToPage(1,曲线:'Cubic' 实例,持续时间:'Duration' 实例)”
这就是我所说的:
PageView.builder(
itemBuilder: (context, i) {
return _prodctReview2(context, i);
},
itemCount: currentReview.order.orderDetails.length,
controller: _pageController,
)
这是我正在调用的函数:
Future nextPage(i) async {
var next = currentPageValue + 1;
print(i);
if (i == currentReview.order.orderDetails.length) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DriverReviewPage(
currentReview: recommendedProducts[i],
)));
} else {
_pageController.jumpToPage(
next,
);
}
}
当我调用该函数时,我收到此错误
未处理的异常:NoSuchMethodError:在 null 上调用了方法“jumpToPage”。接收方:null 尝试调用:jumpToPage(1)
我不知道为什么,因为页面是附加的。