skip to Main Content
[enter image description here](https://i.stack.imgur.c[enter image description here](https://phpout.com/wp-content/uploads/2023/07/W0jyh.png)om/yzTRX.png)

i wanted images to appear randomly when button is presssed

2

Answers


  1. You need to set the key value in proper way

    I can correct it for you plz provide me the code as text

    Login or Signup to reply.
  2. At the first image, it’s just warning and this problem can be solved easily by adding key to your contructors

    class RandomImages extends StatefulWidget {
      const RandomImages({super.key}); // add this
      ...
    }
    

    For second image, you can pass a Function as value of onPressed

    onPressed: () {
      // onPressed actions
    },
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search