E/flutter (26872): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)]
Unhandled Exception: Null check operator used on a null value
E/flutter (26872): #0
MethodChannelFirebaseMessaging.registerBackgroundMessageHandler
(package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:173:53)
E/flutter (26872): #1
FirebaseMessagingPlatform.onBackgroundMessage=
(package:firebase_messaging_platform_interface/src/platform_interface/platform_interface_messaging.dart:108:16)
// Background Messaging Set Up
Future<void> _firebaseMessagingBackgroundHandler(
RemoteMessage message) async {
print('background message');
}
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
runApp(....)
I am getting an error for this code on Android system. Everything works except when the app is terminated.
What works on Android:
- Notification when Terminated, onBackground and onForeground
- Date only when onForeground
What does not work on Android:
- Data only when Terminated and onBackground
What works on iOS:
- Notification when Terminated, onBackground and onForeground
- Date only when onForeground
What does not work on iOS:
- Data only when Terminated,
I have no clue why I am getting that null value error on Android system and how can I fix this issue? Also, is it true that I can not receive the Data only
push notification on iOS when the app is terminated?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…