Uranus_ly
Uranus_ly

Reputation: 153

The following assertion was thrown resolving an image codec:

enter image description here

ListView(
                  scrollDirection: Axis.vertical,
                  physics: ClampingScrollPhysics(),  
                  shrinkWrap: true,
                children: [Column(
                  children: [
                    Buttons(),
                        Text("Premium Exclusive"),
                        Column(
                            children: [
                              Row(
                                  children: [
                                    Container(
                                      width: 100,
                                      height: 100,
                                      decoration: BoxDecoration(
                                          image: DecorationImage(
                                              image: AssetImage(
                                                  'assets/images/components/shop/shop_giftcard.png')
                                          )
                                      ),
                                    ),
                                    Container(
                                      width: 100,
                                      height: 100,
                                      decoration: BoxDecoration(
                                          image: DecorationImage(
                                              image: AssetImage(
                                                  'assets/images/components/shop/shop_giftcard.png')
                                          )
                                      ),
                                    ),
                                  ]
                              ),
                              Row(
                                  children: [
                                    Container(
                                      width:  100,
                                      height: 200,
                                      decoration: BoxDecoration(
                                          image: DecorationImage(
                                              image: AssetImage(
                                                  'assets/images/components/shop/shop_giftcard.png')
                                          )
                                      ),
                                    ),
                                    Container(
                                      width: 100,
                                      height: 200,
                                      decoration: BoxDecoration(
                                          image: DecorationImage(
                                              image: AssetImage(
                                                  'assets/images/components/shop/shop_giftcard.png')
                                          )
                                      ),
                                    ),
                                  ]
                              ),
                            ]
                        ),

Hi, I'm flutter beginner.. When I put the image in container in listview, It doesn't apper and error like a picture below. I don't understand and how to resolve that in the error messages.. please give some advice and aprreciate that,,

---error--- Error while trying to load an asset: Failed to load asset at "assets/assets/images/components/shop/shop_giftcard.png" (404)

======== Exception caught by image resource service ================================================

Is it problem related with image file that I put in asset folder in not correctly?

Upvotes: 0

Views: 457

Answers (1)

brook yonas
brook yonas

Reputation: 526

make this change to all AssetImage widget. make sure pubspec.yaml spacing is correct.

First in your pubspec.yaml file

flutter:
  uses-material-design: true
  assets:
    - assets/images/components/shop/

then in you code

AssetImage(                                                
  'assets/images/components/shop/shop_giftcard.png' 
)

Upvotes: 0

Related Questions