-2

I want to display a text on the screen on random place on random time for some duration. Position I figured out with the positioned like this : - but can't figure out how do I do it on the random time.

Positioned(
                  top: Random().nextDouble() * 1000,
                  right: Random().nextDouble() * 1000,
                  child: Text(
                    "data",
                    style: TextStyle(color: Colors.red),
                  ),
                );

Any workaround?

keval
  • 39
  • 1
  • 7

1 Answers1

1

Check this answer to get a sense of who to do something later in time https://stackoverflow.com/a/15298728/5532723 You just need to make the duration value generated at random time., note that if the unit is millisecond and you generated a number between 1 and 10, then multiple by 1000 and the function should run at random time (in the future certainly) at random time between 1 and 10 second or 1000 and 10,000 millisecond