Repository: flutter
Issue: The argument type 'ModalRoute<Object?>?' can't be assigned to the parameter type 'PageRoute<dynamic>'
Labels: c: crash,framework,f: material design,d: api docs,f: routes,has reproducible steps,P2,found in release: 3.3,found in release: 3.7,team-framework,triaged-framework

**Steps to Reproduce:** 

1.) setup `RouteObservers` on a widget (lets call it `MyWidget`) like in example: https://api.flutter.dev/flutter/widgets/RouteObserver-class.html
2.) use `showGeneralDialog` to present `MyWidget`

**Expected results:** 

`MyWidget` should subscribe to `RouteObservers` without throwing an exception

**Actual results:** 

exception is throwed: `type '_DialogRoute<void>' is not a subtype of type 'PageRoute<dynamic>'`

Exception is throwed here:

```
routeObserver
    .subscribe(this, ModalRoute.of(context));
```

**`flutter doctor -v`**

```
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.5 19F101, locale en-GB)
    • Flutter version 1.17.5 at /Users/myuser/sdk/flutter
    • Framework revision 8af6b2f038 (3 weeks ago), 2020-06-30 12:53:55 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/myuser/Library/Android/sdk
    • Platform android-29, build-tools 29.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_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.6, Build version 11E708
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.47.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.12.2

[✓] Connected device (1 available)
    • SM A600FN • 520085adecae3553 • android-arm • Android 10 (API 29)

• No issues found!
```

**`flutter run --verbose`**

<details> 
<summary>logs</summary> 

```
[ +615 ms] I/flutter (12837): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
[        ] I/flutter (12837): The following _TypeError was thrown building Builder:
[        ] I/flutter (12837): type '_DialogRoute<void>' is not a subtype of type 'PageRoute<dynamic>'
[        ] I/flutter (12837): 
[        ] I/flutter (12837): The relevant error-causing widget was:
[        ] I/flutter (12837):   SlideTransition file:///Users/myuser/Flutter/myapp/lib/utils/router.dart:67:16
[        ] I/flutter (12837): 
[        ] I/flutter (12837): When the exception was thrown, this was the stack:
[        ] I/flutter (12837): #0      MyWidgetState.didChangeDependencies (package:myapp/base/my_widget.dart:38:26)
[        ] I/flutter (12837): #1      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4661:12)
[        ] I/flutter (12837): #2      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
[        ] I/flutter (12837): ...     Normal element mounting (106 frames)
[        ] I/flutter (12837): #108    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
[        ] I/flutter (12837): #109    Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
[        ] I/flutter (12837): #110    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5580:32)
[        ] I/flutter (12837): #111    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5957:17)
[   +3 ms] I/flutter (12837): #112    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #113    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (12837): #114    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
[        ] I/flutter (12837): #115    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[        ] I/flutter (12837): #116    StatefulElement.update (package:flutter/src/widgets/framework.dart:4707:5)
[        ] I/flutter (12837): #117    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #118    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (12837): #119    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[   +7 ms] I/flutter (12837): #120    ProxyElement.update (package:flutter/src/widgets/framework.dart:4862:5)
[        ] I/flutter (12837): #121    _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:181:11)
[        ] I/flutter (12837): #122    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #123    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5837:14)
[        ] I/flutter (12837): #124    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #125    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (12837): #126    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
[        ] I/flutter (12837): #127    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[   +3 ms] I/flutter (12837): #128    StatefulElement.update (package:flutter/src/widgets/framework.dart:4707:5)
[        ] I/flutter (12837): #129    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #130    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5837:14)
[        ] I/flutter (12837): #131    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #132    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5837:14)
[        ] I/flutter (12837): #133    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #134    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (12837): #135    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[ +322 ms] I/flutter (12837): #136    StatelessElement.update (package:flutter/src/widgets/framework.dart:4583:5)
[        ] I/flutter (12837): #137    Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
[        ] I/flutter (12837): #138    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
[        ] I/flutter (12837): #139    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
[        ] I/flutter (12837): #140    Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
[        ] I/flutter (12837): #141    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2627:33)
[        ] I/flutter (12837): #142    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:20)
[        ] I/flutter (12837): #143    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
[   +3 ms] I/flutter (12837): #144    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
[        ] I/flutter (12837): #145    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
[        ] I/flutter (12837): #146    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)
[        ] I/flutter (12837): #150    _invoke (dart:ui/hooks.dart:261:10)
[        ] I/flutter (12837): #151    _drawFrame (dart:ui/hooks.dart:219:3)
[        ] I/flutter (12837): (elided 3 frames from dart:async)
[        ] I/flutter (12837): 
[        ] I/flutter (12837): ════════════════════════════════════════════════════════════════════════════════════════════════════
```

</details>