Repository: flutter
Issue: Can't showModalBottomSheet inside of RouteObserver.didPop
Labels: framework,f: material design,d: stackoverflow,has reproducible steps,found in release: 3.3,found in release: 3.5,team-design,triaged-design

I am listen Navigetor navigatorObservers and when user exist form some screens I want to show modal popup. I call showModalBottomSheet inside MyRouteObserver.didPop method and have error.


**Target Platform:** Android
**Target OS version/browser:** Android 8.1.0, MINU 10.2


## Logs

```
[   +8 ms] V/FA      (29143): Setting current screen to name, class: /, Flutter
[   +1 ms] I/flutter (29143): 10-01-2020–14:35:44:3544 [feedback_bloc]: didPop: previousRouteName - /, routeName - /place
[        ] I/flutter (29143): 10-01-2020–14:35:44:3544 [feedback_bloc]: place card closed -> show feedback bottom sheet
[        ] I/flutter (29143): 10-01-2020–14:35:44:3544 [feedback_bloc]: showFeedbackBottomSheet
[        ] V/FA      (29143): Recording user engagement, ms: 5406
[   +5 ms] I/flutter (29143): Flutter error caught by Crashlytics plugin:
[   +6 ms] D/FA      (29143): Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=Flutter, firebase_previous_id(_pi)=-6308074188998608129,
firebase_previous_screen(_pn)=/place, firebase_screen_class(_sc)=Flutter, firebase_screen_id(_si)=-6308074188998608128, firebase_screen(_sn)=/}]
[  +43 ms] I/flutter (29143): ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════
[        ] I/flutter (29143): The following assertion was thrown while dispatching notifications for ValueNotifier<RefreshStatus>:
[        ] I/flutter (29143): 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1782 pos 12: '!_debugLocked':
[        ] I/flutter (29143): is not true.
[        ] I/flutter (29143): 
[   +2 ms] I/flutter (29143): Either the assertion indicates an error in the framework itself, or we should provide substantially
[        ] I/flutter (29143): more information in this error message to help you determine and fix the underlying cause.
[        ] I/flutter (29143): In either case, please report this assertion by filing a bug on GitHub:
[        ] I/flutter (29143):   https://github.com/flutter/flutter/issues/new?template=BUG.md
[   +3 ms] I/flutter (29143): 
[        ] I/flutter (29143): When the exception was thrown, this was the stack:
[        ] I/flutter (29143): #2      NavigatorState.push (package:flutter/src/widgets/navigator.dart:1782:12)
[        ] I/flutter (29143): #3      showModalBottomSheet (package:flutter/src/material/bottom_sheet.dart:532:65)
[        ] I/flutter (29143): #4      FeedbackBloc.showFeedbackBottomSheet (package:gohere/domain/feedback_bloc.dart:119:5)
[        ] I/flutter (29143): #5      FeedbackBloc.didPop (package:gohere/domain/feedback_bloc.dart:90:7)
[        ] I/flutter (29143): #6      NavigatorState.pop (package:flutter/src/widgets/navigator.dart:2136:20)
[        ] I/flutter (29143): #7      Navigator.pop (package:flutter/src/widgets/navigator.dart:1387:34)
[        ] I/flutter (29143): #8      _PlacePageState._exit (package:gohere/ui/page/place_page.dart:330:15)
[        ] I/flutter (29143): #9      RefreshIndicatorState._handleModeChange (package:pull_to_refresh/src/internals/indicator_wrap.dart:275:50)
[        ] I/flutter (29143): #10     ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:206:21)
[        ] I/flutter (29143): #11     ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:273:5)
[        ] I/flutter (29143): #12     IndicatorStateMixin.mode= (package:pull_to_refresh/src/internals/indicator_wrap.dart:552:28)
[        ] I/flutter (29143): #13     RefreshIndicatorState._dispatchModeByOffset.<anonymous closure> (package:pull_to_refresh/src/internals/indicator_wrap.dart:218:11)
[        ] I/flutter (29143): (elided 15 frames from class _AssertionError and package dart:async)
[        ] I/flutter (29143): 
[        ] I/flutter (29143): The ValueNotifier<RefreshStatus> sending notification was:
[        ] I/flutter (29143):   ValueNotifier<RefreshStatus>#61913(RefreshStatus.refreshing)
[        ] I/flutter (29143): ════════════════════════════════════════════════════════════════════════════════════════════════════
[  +18 ms] D/FA      (29143): Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=5406, firebase_screen_class(_sc)=Flutter,
firebase_screen_id(_si)=-6308074188998608129, firebase_screen(_sn)=/place}]
[  +32 ms] I/flutter (29143): 10-01-2020–14:35:44:3544 [video_service]: setVideoUrl called for: https://api.terra-incognita.tk/static/d38cd2ae-22ef-4618-9e0b-1f4da8eb0a8f
[        ] I/flutter (29143): 10-01-2020–14:35:44:3544 [video_service]: Same vide
```

```
flutter doctor -v
[✓] Flutter (Channel dev, v1.13.7, on Mac OS X 10.15.2 19C57, locale en-RU)
    • Flutter version 1.13.7 at /Users/sanekyy/Programs/flutter
    • Framework revision a3bbdfb23a (7 days ago), 2020-01-03 16:19:11 -0500
    • Engine revision eb139936eb
    • Dart version 2.8.0 (build 2.8.0-dev.0.0 2f57602411)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/sanekyy/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Users/sanekyy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Users/sanekyy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • 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.3.1)
    • IntelliJ at /Users/sanekyy/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    ✗ 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

[!] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • Redmi Note 6 Pro • 3193ac21   • android-arm64  • Android 8.1.0 (API 27)
    • macOS            • macOS      • darwin-x64     • Mac OS X 10.15.2 19C57
    • Chrome           • chrome     • web-javascript • Google Chrome 79.0.3945.117
    • Web Server       • web-server • web-javascript • Flutter Tools

! Doctor found issues in 2 categories.
```