Non-dismissible AlertDialog — Flutter

Hamza Mateen
4 min readMay 21, 2023

Popup messages like the one shown above are a way of diverting users’ attention towards important information. It could be a warning, an update, or just an FYI.

Displaying messages in popups has come a long way and Flutter provides a simple showDialog method to display custom dialogs with their own lifecycle, title, content, actions, and appearance.

The need might arise where the popups should behave as blockers when the user is not allowed to go further and is not even allowed to close the popup. In this article, an instance of AlertDialog will be created, totally blocking the user from doing anything but only the actions authorised within the popup.

showDialog takes in the current context and a builder function with a few more powerful properties we will explore below.

Let us start with a straightforward example of an AlertDialog in Flutter.

The AlertDialog shown in the image can be closed by pressing the phone's back button or tapping…

--

--

Hamza Mateen

Front-End Development Lead at MiFinity | All about Flutter Application Development & Life in Ireland. Flutter App Developer | Lecturer | Writer.