showNotification method

  1. @override
Future<void> showNotification({
  1. required dynamic message,
})
override

Implementation

@override
Future<void> showNotification( { required /*RemoteMessage*/ message }) async {
  try{
    MessageNotificationModel notify = MessageNotificationModel();
    if( message.data.isNotEmpty ){
      notify = MessageNotificationModel.fromJsonData(message.data);
    }else{
      notify = MessageNotificationModel.parseNotification(message.notification);
    }
    logCat('NotificationRepository::showNotification title: ${notify.title} / body:${notify.body} / image:${notify.imagePath} / payload:${notify.payload}');
    logCat('NotificationRepository::showNotification channelId: ${notify.channel.id} / channelName:${notify.channel.name} / channelDescription:${notify.channel.description}');

    if(notify.imagePath!='' && notify.imagePath.isNotEmpty) {
      try{
        await showBigPictureNotificationHiddenLargeIcon(mNotif: notify );
      }catch(e) {
        await showBigTextNotification(mNotif: notify );
      }
    }else {
      await showBigTextNotification(mNotif: notify );
    }
  }catch(ex, trace){
    logError(ex, trace: trace, position: 'showNotification');
  }
}