Flutter firebase onBackgroundMessage throws exception #4712
Unanswered
bilalgodesto
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When i add this function to my code.
FirebaseMessaging.onBackgroundMessage(
(message) => _handleBG(message, currentUserId));
I get exception
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: NoSuchMethodError: The method 'toRawHandle' was called on null
onMessage method below is working fine.
FirebaseMessaging.onMessage.listen((event) async {
// event.messageType
print('hearing to foreground messsage');
if (event.data['messageType'] == 'chat') {
await ChatHelper.handleMessageReceived(event, context, currentUserId);
//setState(() {});
Beta Was this translation helpful? Give feedback.
All reactions