Cannot Navigate To Next Page PageView


I am using a pageview builder but cannot iterate through the pages. I keep getting this error:

“The method ‘animateToPage’ was called on null.
Receiver: null
Tried calling: animateToPage(1, curve: Instance of ‘Cubic’, duration: Instance of ‘Duration’)”

Here is what I’m calling:

                        itemBuilder: (context, i) {
                          return _prodctReview2(context, i);
                        itemCount: currentReview.order.orderDetails.length,
                        controller: _pageController,

Here is the function I’m calling:

 Future nextPage(i) async {
    var next = currentPageValue + 1;


    if (i == currentReview.order.orderDetails.length) {
              builder: (context) => DriverReviewPage(
                    currentReview: recommendedProducts[i],
    } else {

When I call the function I get this error

Unhandled Exception:
NoSuchMethodError: The method ‘jumpToPage’ was called on null.
Receiver: null Tried calling: jumpToPage(1)

I’m not sure why because the pages are attached.


According to the Error, it is possible that the _pageController is not properly initialized. For example, in a stateful widget, you have to initialize the _pageController variable in the initState method.

void initState(){
    _pageController = PageController(initialPage: 0);

Answered By – Frenco

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *