Skip to content
This repository was archived by the owner on Nov 20, 2022. It is now read-only.

Commit 5d1fced

Browse files
committed
⚡ Improve showNotification function
1 parent 0df2c54 commit 5d1fced

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/firebase.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,15 @@ void initFirebase(GlobalKey<NavigatorState> navigatorKey) {
4444

4545
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
4646
print("message received from Firebase Messaging");
47-
if (message.data['type'] != null) showNotification(message);
47+
if (message.data['type'] != null) showNotification(message.notification.title, message.notification.body);
4848
});
4949
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async {
5050
print("notification clicked by the user");
5151
if (message.data['type'] != null) handleSelectNotification();
5252
});
5353
}
5454

55-
showNotification(RemoteMessage notificationData) async {
56-
final title = notificationData.notification.title;
57-
final body = notificationData.notification.body;
55+
showNotification(String title, String body) async {
5856
final android = new AndroidNotificationDetails(title, title, title,
5957
styleInformation: BigTextStyleInformation(''));
6058
final iOS = new IOSNotificationDetails();

0 commit comments

Comments
 (0)