Repository: flutter
Issue: Error message should be more verbose when Navigator.pop() is called accidentally
Labels: framework,f: routes,a: error message,has reproducible steps,P2,found in release: 3.7,found in release: 3.8,team-framework,triaged-framework

## Steps to Reproduce

<!-- You must include full steps to reproduce so that we can reproduce the problem. -->

1. Run `flutter create bug`.
2. Add `Navigator.pop()` to the `onPressed` method of the `FloatingActionButton`.
3. Run the app and press the button.
4. Hot reload the app.

**Expected results:** Verbose error message in the console that mentions that you may have accidentally called `Navigator.pop()` in the wrong context.

**Actual results:** 
`'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2855 pos 12: '_history.isNotEmpty': is not true.`

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Navigator-[GlobalObjectKey<NavigatorState> _WidgetsAppState#3f9ff](dirty, state: NavigatorState#69d35(tickers: tracking 0 tickers)):
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2855 pos 12: '_history.isNotEmpty': is not true.


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=BUG.md

The relevant error-causing widget was
    MaterialApp    lib/main.dart:XX
When the exception was thrown, this was the stack
#2      NavigatorState.build                package:flutter/…/widgets/navigator.dart:2855
#3      StatefulElement.build               package:flutter/…/widgets/framework.dart:4604
#4      ComponentElement.performRebuild     package:flutter/…/widgets/framework.dart:4492
#5      StatefulElement.performRebuild      package:flutter/…/widgets/framework.dart:4660
#6      Element.rebuild                     package:flutter/…/widgets/framework.dart:4216
...
════════════════════════════════════════════════════════════════════════════════
```
```
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel master, v1.14.7-pre.138, on Linux, locale en_US.UTF-8)
    • Flutter version 1.14.7-pre.138 at /.../flutter
    • Framework revision 49be146953 (5 hours ago), 2020-02-05 18:02:20 -0800
    • Engine revision 81dffd1241
    • Dart version 2.8.0 (build 2.8.0-dev.7.0 c8ed304e97)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /.../Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /snap/android-studio/81/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Linux toolchain - develop for Linux desktop
    • clang++ 9.0.0
    • GNU Make 4.2.1

[✓] Android Studio (version 3.5)
    • Android Studio at /snap/android-studio/81/android-studio
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
    • IntelliJ at /.../idea-IU-192.6262.58
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] Connected device (2 available)
    • ONEPLUS A6013 • 93a8e251 • android-arm64 • Android 10 (API 29)
    • Linux         • Linux    • linux-x64     • Linux

! Doctor found issues in 1 category.
```

</details>