I have a problem, in pubspec.yaml
I added new images through - assets/images/google.png
, and also - assets/images/notifications.png
, for some reason, I can use google.png image, but all the others – there is an error Asset not found, it’s very strange, Flutter SDK is the latest version.
Don’t say: "Check the syntax and the number of indents in this file", I checked, there are no errors anywhere, I did everything exactly the same as in the google.png example, it works."
In the screenshot you can see, the pubspec.yaml file, my code where I want to insert the image, and also on the left, the files, and above you can see that the files exist
════════ Exception caught by image resource service ════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset: "assets/images/test.png".
Exception: Asset not found
3
Answers
change this code
By specifying the directory path, you can access the files inside the directory.
finally
Look at the below screenshot and compare the indentation (spacing). If you think everything is identical, you’re good to go & if not? Then, make it.
Now, stop the current program and execute the below-mentioned commands in the project terminal one by one:
When path is correct and its not showing the image then just simply close the app and restart the app it’ll work.