以下断言被抛出解析图像编解码器:无法加载资产

问题描述 投票:0回答:0

这是我运行应用程序时的代码,它显示无法加载资产,任何可以帮助我的人。提前谢谢你。

小部件构建(BuildContext 上下文){

return Scaffold(

  appBar: AppBar(

    backgroundColor: Colors.teal,

    title: Text('Product List'),

    centerTitle: true,

    actions: [

      Center(

        child: badges.Badge(

          badgeContent: Text('0',style: TextStyle(color: 

颜色.白色),),

          child: Icon(Icons.shopping_cart_outlined),


        ),


      ),


      SizedBox(width: 20,)


    ],

  ),



  body: Column(


    children: [


      Expanded(


        child: ListView.builder(

          itemCount: productName.length,


            itemBuilder: (context, index){


          return Card(

            child: Column(


              children: [


                Row(


                  children: [


                    Expanded(

                      child: Image(


                        height: 100,


                        width: 100,


                        image: 

Image.asset(productImage[index].toString()).image,

                      ),


                    ),


                    Text(index.toString())


                  ],


                )


              ],

            ),


          );


        }),


      )


    ],


  ),


);

错误:

抛出以下断言来解析图像编解码器: 无法加载资产:“https://www.shutterstock.com/image-photo/mango-fruit-isolated-on-white-background-1688546254”。

异常:找不到资产 抛出异常时,这是堆栈: #0 PlatformAssetBundle.loadBuffer(包:flutter/src/services/asset_bundle.dart:295:7) #1 AssetBundleImageProvider._loadAsync(包:flutter/src/painting/image_provider.dart:731:35) #2 AssetBundleImageProvider.loadBuffer(包:flutter/src/painting/image_provider.dart:695:14) #3 ImageProvider.resolveStreamForKey。 (包:flutter/src/painting/image_provider.dart:513:13) #4 ImageCache.putIfAbsent(包:flutter/src/painting/image_cache.dart:384:22) #5 ImageProvider.resolveStreamForKey(包:flutter/src/painting/image_provider.dart:511:81) #6 ScrollAwareImageProvider.resolveStreamForKey(包:flutter/src/widgets/scroll_aware_image_provider.dart:106:19) #7 ImageProvider.resolve。 (包:flutter/src/painting/image_provider.dart:358:9) #8 ImageProvider._createErrorHandlerAndKey。 (包:flutter/src/painting/image_provider.dart:473:24) 图片提供者:AssetImage(bundle: null, name: "https://www.shutterstock.com/image-photo/mango-fruit-isolated-on-white-background-1688546254") 图片键:AssetBundleImageKey(包:PlatformAssetBundle#5d018(),名称:“https://www.shutterstock.com/image-photo/mango-fruit-isolated-on-white-background-1688546254”,比例:1.0)

flutter assets networkimageview
© www.soinside.com 2019 - 2024. All rights reserved.