Skip to content

Flutter firebase messaging example app gets a crash report when run in a sequence #17112

Closed

Description

@JohnAherne

Steps to Reproduce

Start the app with flutter run -v

Put app in backgound
Send a message - notification and data message
The message appears but not in the correct position. See screen image "background_app_send_message.PNG"
Back to main screen
Stay in foreground
Send a message - notification and data
Select show from popup.
App crashes. See screen shot:

"fire_error_when_open.PNG"
background_app_send_message
fire_error_when_foregound

Logs

start app
put into background
send message in background
show message is fine but layout not quite right
back to main screen
leave in foreground
send message
get popup
hit show get error screen

[  +42 ms] Compiling dart to kernel with 414 updated files
[ +476 ms] I/flutter (19510): Push Messaging token: emCSa6FmEN4:APA91bGl2VdOigd4W4vgyAioS_Yg8U2jnSvYjHw6l3kxH6Hzkl8nIeDAiOV7JpfU2yIAnUaHjADGZYAiZ42o0veqMdf_ccl4RFc1wO2GsPRbcI0Eaes4WNzfCcbw_3QiKK16_PNpunJ_
[ +885 ms] Updating files
[ +622 ms] DevFS: Sync finished
[        ] Synced 1.1MB.
[   +3 ms] _flutter.listViews: {}
[   +4 ms] Connected to _flutterView/0x9c2acce0.
[        ] ??  To hot reload your app on the fly, press "r". To restart the app entirely, press "R".
[        ] An Observatory debugger and profiler on Android SDK built for x86 is available at: http://127.0.0.1:8113/
[        ] For a more detailed help message, press "h". To quit, press "q".
[+2754 ms] D/EGL_emulation(19510): eglMakeCurrent: 0x9a28b900: ver 3 0 (tinfo 0x9c2963a0)
[+12463 ms] I/FlutterActivityDelegate(19510): onResume setting current activity to this
[  +48 ms] I/flutter (19510): onResume: {google.sent_time: 1525085754634, click_action: FLUTTER_NOTIFICATION_CLICK, status: 280418, collapse_key: com.example.fcmtest1, id: 12345, from: 915347252314, google.message_id: 0:1525085754638812%fe1fa160fe1fa160, google.ttl: 2419200}
[   +3 ms] D/EGL_emulation(19510): eglCreateContext: 0x9a28c800: maj 3 min 0 rcv 3
[  +94 ms] D/EGL_emulation(19510): eglMakeCurrent: 0x9a28c800: ver 3 0 (tinfo 0x9a2f16e0)
[   +1 ms] E/eglCodecCommon(19510): glUtilsParamSize: unknow param 0x00008cdf
[        ] E/eglCodecCommon(19510): glUtilsParamSize: unknow param 0x00008824
[   +3 ms] D/EGL_emulation(19510): eglMakeCurrent: 0x9a28c800: ver 3 0 (tinfo 0x8777e850)
[ +184 ms] D/EGL_emulation(19510): eglMakeCurrent: 0x9a28b900: ver 3 0 (tinfo 0x9c2963a0)
[+18147 ms] I/flutter (19510): onMessage: {status: 280418, id: 12345, click_action: FLUTTER_NOTIFICATION_CLICK}
[+2265 ms] E/flutter (19510): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
[   +1 ms] E/flutter (19510): 'package:flutter/src/widgets/routes.dart': Failed assertion: line 177 pos 12: '!_transitionCompleter.isCompleted': Cannot install a MaterialPageRoute<Null> after disposing it.
[        ] E/flutter (19510): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:37:39)
[        ] E/flutter (19510): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:33:5)
[        ] E/flutter (19510): #2      TransitionRoute.install (package:flutter/src/widgets/routes.dart)
[        ] E/flutter (19510): #3      ModalRoute.install (package:flutter/src/widgets/routes.dart:740:11)
[        ] E/flutter (19510): #4      NavigatorState.push (package:flutter/src/widgets/navigator.dart:1444:11)
[        ] E/flutter (19510): #5      Navigator.push (package:flutter/src/widgets/navigator.dart:817:34)
[        ] E/flutter (19510): #6      _PushMessagingExampleState._navigateToItemDetail (file:///C:/flutter_tests/fcm_test1/lib/main.dart:133:17)
[        ] E/flutter (19510): #7      _PushMessagingExampleState._showItemDialog.<anonymous closure> (file:///C:/flutter_tests/fcm_test1/lib/main.dart:123:9)
[        ] E/flutter (19510): #8      _RootZone.runUnary (dart:async/zone.dart:1381:54)
[        ] E/flutter (19510): #9      _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
[        ] E/flutter (19510): #10     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:633:45)
[        ] E/flutter (19510): #11     Future._propagateToListeners (dart:async/future_impl.dart:662:32)
[        ] E/flutter (19510): #12     Future._completeWithValue (dart:async/future_impl.dart:477:5)
[        ] E/flutter (19510): #13     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:507:7)
[        ] E/flutter (19510): #14     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
[        ] E/flutter (19510): #15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
[  +22 ms] I/flutter (19510): --¦ EXCEPTION CAUGHT BY WIDGETS LIBRARY ¦-----------------------------------------------------------
[   +2 ms] I/flutter (19510): The following assertion was thrown building Navigator-[GlobalObjectKey<NavigatorState>
[        ] I/flutter (19510): _WidgetsAppState#19b4d](dirty, state: NavigatorState#13fc1(tickers: tracking 2 tickers)):
[        ] I/flutter (19510): 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1846 pos 12: '!_debugLocked':
[        ] I/flutter (19510): is not true.
[   +2 ms] I/flutter (19510):
[   +1 ms] I/flutter (19510): Either the assertion indicates an error in the framework itself, or we should provide substantially
[        ] I/flutter (19510): more information in this error message to help you determine and fix the underlying cause.
[        ] I/flutter (19510): In either case, please report this assertion by filing a bug on GitHub:
[        ] I/flutter (19510):   https://github.com/flutter/flutter/issues/new
[        ] I/flutter (19510):
[        ] I/flutter (19510): When the exception was thrown, this was the stack:
[  +28 ms] I/flutter (19510): #2      NavigatorState.build (package:flutter/src/widgets/navigator.dart)
[   +1 ms] I/flutter (19510): #3      StatefulElement.build (package:flutter/src/widgets/framework.dart:3713:27)
[        ] I/flutter (19510): #4      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3625:15)
[        ] I/flutter (19510): #5      Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
[        ] I/flutter (19510): #6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2225:33)
[        ] I/flutter (19510): #7      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:621:20)
[        ] I/flutter (19510): #8      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
[        ] I/flutter (19510): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
[        ] I/flutter (19510): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
[        ] I/flutter (19510): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
[        ] I/flutter (19510): #12     _invoke (dart:ui/hooks.dart:120:13)
[        ] I/flutter (19510): #13     _drawFrame (dart:ui/hooks.dart:109:3)
[        ] I/flutter (19510): (elided 2 frames from class _AssertionError)
[        ] I/flutter (19510): ----------------------------------------------------------------------------------------------------

Flutter Doctor

:\flutter_tests>flutter doctor -v
[v] Flutter (Channel beta, v0.2.8, on Microsoft Windows [Version 10.0.16299.371], locale en-GB)
    • Flutter version 0.2.8 at c:\flutter_dev\flutter
    • Framework revision b397406561 (4 weeks ago), 2018-04-02 13:53:20 -0700
    • Engine revision c903c217a1
    • Dart version 2.0.0-dev.43.0.flutter-52afcba357

[v] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\john2\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[v] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[v] VS Code, 64-bit edition (version 1.22.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Dart Code extension version 2.12.0

[v] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

• No issues found!
.
##Flutter Analyze
Analyzing C:\flutter_tests\fcm_test1...
  error - The constructor returns type 'dynamic' that isn't of expected type 'Widget' at test\widget_test.dart:15:29 - strong_mode_invalid_cast_new_expr
  error - Undefined class 'MyApp' at test\widget_test.dart:15:33 - undefined_class
  hint - Unused import: 'package:fcm_test1/main.dart' at test\widget_test.dart:10:8 - unused_import
3 issues found

Activity

  1. JohnAherne commented on May 4, 2018

    @JohnAherne
    Author

    In case anyone is interested.

    The example stores the routes in a map. These routes are persisted. So if you send the same message id it will not update the entry in the map.

    When you back out of the detail route, the route is disposed. But if you send the same message it will not update the route that is stored. So producing the error when it tries to run the route again.

    The solution if you want to send the same message each time is to remove the entry for the map before trying to add a new one.

    Of course the routes map keeps on getting larger.

    The same applies to the _item map. That keeps all entries permanently so keeps on growing.

  2. added this to the milestone on Jan 28, 2019
  3. kroikie commented on Oct 13, 2019

    @kroikie

    @JohnAherne

    This issue has been moved to firebase/flutterfire#840. Any further collaboration will be done there.

  4. added 3 commits that reference this issue on May 8, 2020
  5. github-actions commented on Aug 15, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolep: firebaseObsolete - Firebase pluginsp: firebase_messagingObsolete - The Firebase Messaging pluginpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions