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
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 https://pub.dev/packages/platform, 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)