The following assertion was thrown resolving an image codec Unable to load asset https raw githubusercontent com abc jpg

0 votes

Hi Guys,

I am trying to load one image from GitHub to my Flutter App. But it is showing me the below error.

The following assertion was thrown resolving an image codec:
Unable to load asset: https://raw.githubusercontent.com/

I am using the below code.

Container(
          decoration: BoxDecoration(
              image: DecorationImage(
                  image: AssetImage(
                     "https://raw.githubusercontent.com/")
                      .image,
                  fit: BoxFit.cover))
)
Sep 10, 2020 in Others by akhtar
• 38,260 points
• 6,704 views

1 answer to this question.

0 votes

Hi@akhtar,

You are using the wrong parameter. In your case, you are trying to load the image from the internet. So instead of AssetImage, you have to use Image.network keyword.

Container(
          decoration: BoxDecoration(
              image: DecorationImage(
                  image: Image.network(
                     "https://raw.githubusercontent.com/")
                      .image,
                  fit: BoxFit.cover))
)
answered Sep 10, 2020 by MD
• 95,460 points

Related Questions In Others

0 votes
0 answers