skip to Main Content

i am trying to make an image appear on the screen but it just won’t happen. i tried a lot of tutorials but none of them will work! it keeps telling me a bunch of errors like the image is not available for example. enter image description here

Here is my code with all the files names:

2

Answers


  1. Assets are usually kept on a separate folder outside libs. But since you kept it inside libs, add the following line to your pubspec.yaml file just below the flutter: section. It should look like this after you paste the code

    flutter:
      assets:
        - lib/app_images/
    

    this ensures that all the files inside the app_images folders are properly imported.

    Login or Signup to reply.
  2. enter image description here

    • Replace your images with a new location it will help to solve the issue.

      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text("AppMaking.co"),
            centerTitle: true,
            backgroundColor: Colors.blue[900],
          ),
          body: Center(
            child: Image.asset(
              "images/app-making-name-logo.png",
              height: 200,
              width: 200,
            ),
          ),
        );
      }
      
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search