0

我有一个来自服务器的动态列表图像,我想将它们推送到 Carousel Slider 中。但是当我将它们添加到项目中并运行时,我遇到了这个错误:

Class 'String' has no instance method 'map'.
Tried calling: map(Closure: (dynamic) => Builder)

这是我的代码。

 child: Container(
        // width: pageWidth * 0.84,
        height: pageWidth * 0.42,
        child: CarouselSlider(
            options: CarouselOptions(
              height: pageWidth * 0.42,
              aspectRatio: 1,
              viewportFraction: 1,
              autoPlay: true,
              autoPlayInterval: const Duration(seconds:5),
              enableInfiniteScroll: true,
              enlargeCenterPage: true,


        ),

           items : [
       ListView.builder(itemBuilder: (context ,index){
      return  homeView.details![index]['Image'];})].map((i){
        return Builder(
          builder:(BuildContext context) {
            return    ListView.builder(
                scrollDirection: Axis.horizontal,
                itemCount: homeView.details!.length,
                itemBuilder: (context, index) {
                  return Container(
                    width: pageWidth * 0.84,
                    height: pageWidth * 0.42,
                    // margin: EdgeInsets.only(left: 15),
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        fit: BoxFit.cover,
                        image: NetworkImage(i),
                      ),
                      borderRadius: BorderRadius.all(
                        Radius.circular(15),),));});});}).toList(),
4

0 回答 0