flutter (rethrow) When I try to restart the program it takes me to image_provider.dart (rethrow)

Viewed 32
   Padding(
          padding: const EdgeInsets.all(8.0),
          child: Row(
            children: [
              Expanded(
                child: TextButton(
                    onPressed: () {
                      setState(() {
                        leftImageName = Random().nextInt(6) + 1;
                      });
                    },
                    child: Image.asset(
                      'images/$leftImageName.png',
                    )),
              ),
              Expanded(
                child: TextButton(
                    onPressed: () {
                      setState(() {
                        rightImageName = Random().nextInt(6) + 1;
                      });
                    },
                    child: Image.asset('images/$rightImageName.png')),
              ),
            ],
          ),
        ),

When I try to restart the program it takes me to image_provider.dart (rethrow) why ??? Is it wrong with the code or is it something else? And what is the meaning of rethrow can someone help me please

1 Answers

There is nothig wrong with the code actually

  • Make sure you provided the right path to your image.
  • have you added these images to your assets in pubspec.yaml file ?
  • are these images in the root of your project ? ( According to the path you passed to the widget, It means that all your images are in the root folder of your project, where your pubspec.yaml file is located!
Crosscheck your pubspec.yaml very well. The issue might be you have not specify the path to yout image files well.
Related