From my understanding that a back arrow appears after navigating to any page by default. is there a way not to include the back arrow on a certain page of my choice ?
5 Answers
To hide the back button, set the automaticallyImplyLeading property of the Appbar as false
new Scaffold(
appBar: new AppBar(
automaticallyImplyLeading: false,
)
)

- 9,387
- 4
- 43
- 48
Duplicate of https://stackoverflow.com/a/44978595/3013538
I believe the solutions are the following
You actually either:
Don't want to display that ugly back button ( :] ), and thus go for :
AppBar(...,automaticallyImplyLeading: false,...)
;Don't want the user to go back - replacing current view - and thus go for:
Navigator.pushReplacementNamed(## your routename here ##)
;Don't want the user to go back - replacing a certain view back in the stack - and thus use:
Navigator.pushNamedAndRemoveUntil(## your routename here ##, f(Route<dynamic>)→bool);
where f is a function returningtrue
when meeting the last view you want to keep in the stack (right before the new one);Don't want the user to go back - EVER - emptying completely the navigator stack with:
Navigator.pushNamedAndRemoveUntil(## your routename here ##, (_) => false);
Cheers

- 7,726
- 2
- 18
- 27
According to AppBar docs
If the leading widget is omitted, ... Otherwise, if the nearest Navigator has any previous routes, a BackButton is inserted instead.
So you can hide it in such way
new Scaffold(
appBar: new AppBar(
title: new Text("Without back button"),
leading: new Container(),
),
);

- 6,631
- 2
- 29
- 26
-
Thank you very much – Shady Aziza Jul 30 '17 at 11:18
-
This seems to cause the side effect of showing empty space where the back button would normally be, if the page is used as the home page of an app (without `Navigator.push`). `automaticallyImplyLeading: false`, as suggested by Fabio in another answer, seems to be much more of an elegant solution. – xip Apr 19 '18 at 16:09
Set automaticallyImplyLeading to false in AppBar or assign empty container in leading
Using automaticallyImplyLeading
appBar: new AppBar(
title: new Text("Your Text Here"),
automaticallyImplyLeading: false,
),
Using empty Container
appBar: new AppBar(
title: new Text("Your Text Here"),
leading: new Container(),
),

- 1,152
- 10
- 18
In case you want to remove the back button in a FloatingSearchBar, use
automaticallyImplyBackButton: false

- 91
- 2
- 2