I don't know if the problem is in my code or in the ListView. Check out my Final(Edited) code here.
I'm working with pagination. When I reach the last page and scroll up/down the ListView the scrolling got laggy. I thought it might be happening because of this line.
leading: CircleAvatar(backgroundImage: NetworkImage(arrayOfProducts[index]['thumbnail'] ?? "")),
NetworkImage
might be taking time to load the image. Not sure but I think the lag is being caused by it. So I added new package cached_network_image and changed my code to:
leading: CircleAvatar(child: CachedNetworkImage(
imageUrl: arrayOfProducts[index]['thumbnail'] ?? "",
placeholder: new CircularProgressIndicator(),
errorWidget: new Icon(Icons.error),
)),
But it's still laggy and previous images are now being hidden while scrolling.