Swiper : Dynamically change the itemCount

Using Swiper to display 300 images.

Swiper(
itemBuilder:(BuildContext context, int index) {
return _buildSwiperList(imageModel [index],index);
},
index : 0
itemCount: imageModel.length ,
itemWidth:DeviceSize.width(context),
layout: SwiperLayout.STACK,
),
  1. Initial image count is 0. So imageModel.length=0;
  2. itemCount: imageModel.length -> This evaluates as 0.
  3. Once I load the all the images I will come to know about the actual number of images.
  4. itemCount=imageList.length -> This evaluates to 300 or 250 or 200
  5. My Expectation was that I will have smooth scrolling from 0 to 300.
    However Swiper suddenly jumps to something like 228.

I tried -

  1. Set the index=0. Problem is not resolved.
  2. itemCount : _itemCount
    When all the images are load, I call setState(…)
    setState(() {
    _itemCount = imageList.length;
    _index = 0;
    });

Still swiper jumps randomly to some where 228.

If I hard code the itemCount=300, then it works. Hard code to 300 is not possible as imageCount change every time.

Question is how to change itemCount dynamically & make Swiper working properly ?