Show alert dialog on app main screen load automatically in flutter

后端 未结 5 1367
遇见更好的自我
遇见更好的自我 2020-12-08 22:09

I want to show alert dialog based on a condition. Not based on user interaction such as button press event.

If a flag is set in app state data alert dialog is shown

5条回答
  •  生来不讨喜
    2020-12-08 22:46

    Simply override initState and call your _showDialog method inside Timer.run()

    @override
    void initState() {
      super.initState();
      Timer.run(() => _showDialog());
    }
    

提交回复
热议问题