In Flutter, use showGeneralDialog to show a dialog and use barrierDismissible to make it can not be closed when click outside.
But i want to make it can not be closed when click outside for first 2 second, then it can be able to close (barrierDismissible become true).
It seem easy with setState, but this 'showGeneralDialog' is a funtion.
How can i make it?
Flutter declarative approach wasn't applied to this widget. Therefore you should do everything by yourself.
You can use
showDialog()
method and then go for your implementation by creating a globalbarrierDismissible
variable and updating it after 2 seconds. The working solution for your approach is attached below: