Repository: flutter
Issue: Improve error message for type error in maybePop()/pop()
Labels: c: crash,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
Create a new project and have this pop-up box:
```dart
return showDialog<Null>(
    context: context,
    barrierDismissible: false, // user must tap button!
    child: new AlertDialog(
      title: new Text(title),
      content: new SingleChildScrollView(
        child: new ListBody(
          children: <Widget>[
            new Text(msg)
          ],
        ),
      ),
      actions: <Widget>[
        new FlatButton(
          child: new Text('NO'),
          onPressed: () {
            //Navigator.pop(context, "CANCEL");
            Navigator.maybePop(context, "CANCEL");
          },
        ),
        new FlatButton(
          child: new Text('YES'),
          onPressed: () {
            //Navigator.pop(context, "OK");
            Navigator.maybePop(context, "CANCEL");
          },
        ),
      ],
    ),
  ).then((val){
    return val;
  });
```

Once the cancel or OK button is clicked, it generates an error

## Logs
```
E/flutter ( 4523): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 4523): type 'String' is not a subtype of type 'Null' of 'result' where
E/flutter ( 4523):   String is from dart:core
E/flutter ( 4523):   Null is from dart:core
E/flutter ( 4523): 
E/flutter ( 4523): #0      _ModalRoute&TransitionRoute&LocalHistoryRoute.didPop (package:flutter/src/widgets/routes.dart)
E/flutter ( 4523): #1      NavigatorState.pop (package:flutter/src/widgets/navigator.dart:1683:15)
E/flutter ( 4523): #2      NavigatorState.maybePop (package:flutter/src/widgets/navigator.dart:1648:9)
E/flutter ( 4523): <asynchronous suspension>
E/flutter ( 4523): #3      Navigator.maybePop (package:flutter/src/widgets/navigator.dart:1024:34)
E/flutter ( 4523): #4      showMainFrameDialogWithCancel.<anonymous closure> (package:myapp/src/util/ScreenUtils.dart:1334:23)
E/flutter ( 4523): #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:490:14)
E/flutter ( 4523): #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:545:30)
E/flutter ( 4523): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter ( 4523): #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter ( 4523): #9      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
E/flutter ( 4523): #10     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter ( 4523): #11     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter ( 4523): #12     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter ( 4523): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter ( 4523): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter ( 4523): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 4523): #16     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter ( 4523): #17     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter ( 4523): #18     _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter ( 4523): #19     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
```
## Flutter Doctor
```
[✓] Flutter (Channel dev, v0.3.0, on Mac OS X 10.13.4 17E199, locale en-PH)
    • Flutter version 0.3.0 at /Users/macbook/Documents/flutter
    • Framework revision c73b8a7cf6 (13 days ago), 2018-04-12 16:17:26 -0700
    • Engine revision 8a6e64a8ef
    • Dart version 2.0.0-dev.47.0.flutter-4126459025

[!] Android toolchain - develop for Android devices (Android SDK 26.0.3)
    • Android SDK at /Users/macbook/Library/Android/sdk
    • Android NDK at /Users/macbook/Library/Android/sdk/ndk-bundle
    • Platform android-27, build-tools 26.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.3, Build version 9E145
    • ios-deploy 1.9.2
    • CocoaPods version 1.3.1

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2017.2.5)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 19.1
    • Dart plugin version 172.4343.25

[!] VS Code (version 1.17.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Dart Code extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code

[✓] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.0 (API 24) (emulator)
```