MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

Flutter : How to dismiss an AlertDialog on Button?

Problem

I’m showing an AlertDialog on my App, but when I click on no/cancel then AlertDialog doesn’t dismiss, it keep popping the route where I came from. I’ve used Navigator.of(context).pop(); and Navigator.pop(context, false); but both are not working.

Solution

To Dismiss an AlertDialog Navigator.of(context).pop(); works but in my case below code worked.

Navigator.of(context, rootNavigator: true).pop('dialog');

That’s All.

Thanks for reading.

Keep Coding.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x