1

No errors in the code and as far as I can see the pubspec.yaml file is functional, as it worked before.

@override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Column(
            children: [
              Card(
                child: Image.asset('anyaparent.jpeg'),
              ),
            ],
          ),
        ),
      ),
    );

Error text "Unable to load asset"

[1]: https://i.sstatic.net/GeTW2.png The pubspec.yaml file

3
  • 1
    make sure to add images on pubspec.yaml and rebuild the app Commented Aug 4, 2022 at 21:17
  • @YeasinSheikh whoops sorry, i added the pubspec.yaml i dont think theres anything wrong here Commented Aug 4, 2022 at 21:20
  • 1
    try 'images/anyaparent.jpeg', Commented Aug 4, 2022 at 21:22

2 Answers 2

1

try doing like this

Image.asset('images/anyaparent.jpeg'),
Sign up to request clarification or add additional context in comments.

Comments

0

Check your image path images/anyaparent.jpeg

@override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            body: SafeArea(
              child: Column(
                children: [
                  Card(
                    child: Image.asset('images/anyaparent.jpeg'),
                  ),
                ],
              ),
            ),
          ),
        );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.