android – StateError (Bad state: No element) while scrolling Pageview with Videos


I am developing an app with a function like tiktok and I can scrolling videos and display them as well, but everytime I scroll it fast and gave me a Bad State error. I don’t know what else to do. Here’s my code below:

return Observer(builder: (context) {
  return _controller.controllers.isEmpty
      ? _buildLoading()
      : PageView.builder(
          controller: widget.pageController,
          itemCount: widget.posts?.length ?? 0,
          physics: const ClampingScrollPhysics(),
          scrollDirection: Axis.vertical,
          pageSnapping: true,
          onPageChanged: (value) {
          itemBuilder: (context, index) {
            var controller = _controller.controllers
                .where((element) => element.position == index)

            return ISowPost(
                post:, controller: controller.controller);

It seems that controller kinda can’t handle many requests so It breaks and then It reloads.