Issue 1:
Steps to Reproduce

I have pages that when an action is taken it pushes a route to goto another page, I use the code below:

Route route = new MaterialPageRoute(
settings: new RouteSettings(name: "/PostAuthHome"),
builder: (BuildContext context) => new PostAuthHome.PostAuthHome(title: "LOOP Home"),
);
Navigator.of(context).pushReplacement(route);

When I do the Appbar has a back button and should not.

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.6 16G1036, locale en-US, channel master)
• Flutter at /Users/dnetman99/flutter
• Framework revision 0c09179b65 (10 days ago), 2017-12-09 22:04:06 -0800
• Engine revision edb0201fa2
• Tools Dart version 1.25.0-dev.11.0
• Engine Dart version 2.0.0-edge.a38ac7cf127f4611c873c2f2d523c06ce06b1342

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
• Android SDK at /Users/dnetman99/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-26, build-tools 26.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.2.1

[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2.5)
• Flutter plugin version 18.4
• Dart plugin version 172.4343.25

[✓] Connected devices
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
• iPhone 8 • 1D8F1697-B7FC-4319-B06F-C0C3A9C9A626 • ios • iOS 11.2 (simulator)

For more information about diagnosing and reporting Flutter bugs, please see https://flutter.io/bug-reports/.

Issue 2:
Steps to Reproduce

Found this issue when I was trying to navigate from a screen to another using the Navigator.pushReplacement() call, after clearing the Navigator route stack using Navigator.pop(). To reproduce build a two screen app, where both of the screens use a Scaffold with an AppBar.

In your app use

Navigator.popUntil(context, (_) => !Navigator.canPop(context));
Navigator.pushReplacement(
context, new MaterialPageRoute(builder: (BuildContext context) => route));

to navigate from one screen to the other.

The observation is that the app bar shows a back button momentarily, after the route navigation is triggered. The back button disappears in a fraction of a second. No errors are thrown in the log messages.

Here is my sample app, that can be used to reproduce this issue.

import 'package:flutter/material.dart';
import 'package:meta/meta.dart';

void main() {
runApp(new MyApp());
}

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Wifi App',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new AppScaffold(isWifiOn: true),
);
}
}

class AppScaffold extends StatelessWidget {
static final String wifiOnAppBarTitle = "Wifi is On";
static final String wifiOffAppBarTitle = "Wifi is Off";

// Is wifi on, at present
final bool isWifiOn;
AppScaffold({@required this.isWifiOn});

Widget body(BuildContext context) {
return new Center(
child: new GestureDetector(
child: isWifiOn ? new Icon(Icons.wifi) : new Icon(Icons.wifi_off),
onTap: () {
if (isWifiOn) {
clearStackAndPushRoute(context, new AppScaffold(isWifiOn: false));
} else {
clearStackAndPushRoute(context, new AppScaffold(isWifiOn: true));
}
},
));
}

@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: isWifiOn
? new Text(wifiOnAppBarTitle)
: new Text(wifiOffAppBarTitle)),
body: body(context),
);
}
}

void clearStackAndPushRoute(BuildContext context, Widget route) {
Navigator.popUntil(context, (_) => !Navigator.canPop(context));
Navigator.pushReplacement(
context, new MaterialPageRoute(builder: (BuildContext context) => route));
}

Logs

No exceptions thrown

Flutter Doctor

[-] Flutter (on Linux, locale en_US.UTF-8, channel google3)
• Flutter at /google/obj/workspace/d9981df61cffad7a0e5a854147e02734/ee049f8d-e0ae-4e42-ba92-614f4524525c/blaze-out/k8-opt/bin/mobile/flutter/tools/tools.runfiles/google3
• Framework revision null (null), null
• Engine revision null
• Tools Dart version null
✗ Downloaded executables cannot execute on host (see https://github.com/flutter/flutter/issues/6207 for more information)

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
• Android SDK at /usr/local/google/home/kinshul/Android/Sdk
• Platform android-26, build-tools 26.0.2
• Java binary at: /opt/android-studio-with-blaze-2.3/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] Android Studio (version 2.3)
• Android Studio at /opt/android-studio-with-blaze-2.3
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2017.1)
• Flutter plugin version 18.1
• Dart plugin version 171.4694.29

[✓] Connected devices
• Nexus 5X • 00da1e796fb1cf52 • android-arm • Android 6.0 (API 23)

> For more information about diagnosing and reporting Flutter bugs, please see [https://flutter.io/bug-reports/](https://flutter.io/bug-reports/).