How can I hide the AppBar back button based on the platform?


I am hoping to hide all AppBar back buttons throughout my app for Android users, so that they must use the device’s back button instead. But for iOS users, I would like for the AppBar‘s back button to be present since that is the standard way to navigate.

What is the best way to achieve this and is there a way to do it globally using AppBarTheme?

I am aware of AppBar(automaticallyImplyLeading: false, ...) but that hides the back button on both iOS and Android devices.


Set that value based on the platform. You can get the platform with, like so:

AppBar(automaticallyImplyLeading: !Platform.isAndroid, ...)

which will make it false on Android, true everywhere else. You might need to add other platforms if you find it necessary.

Answered By – Randal Schwartz

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *