How do you remove the Flutter notice?



  • Firebase Messaging has a bet onBackgroundMessage that tracks the beam when the annex is complete. He'll be off the list when he hits the punch, but how do we make sure that when you open the app, not through the canvass, you could close some notice on the list?



  • Decided through flutter_local_notifications

    You're on the way. FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);Function which will process background notice when the annex is off

        //Обработка фоновых уведомлений
    Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
      print("Handling a background message: ${message.messageId}");
    

    final localNotificationService = ConnectorServices.DI<LocalNotificationsService>();

    localNotificationService.flutterLocalNotificationsPlugin.show(
    message.data.hashCode,
    message.data['title'],
    message.data['body'],
    NotificationDetails(
    android: AndroidNotificationDetails(
    LocalNotificationsService.channel.id,
    LocalNotificationsService.channel.name,
    ),
    ));
    }

    Next in another place (e.g. when the annex opens, the method cancelAll or cancel(notification_id) is closed or all or a certain pouch on the list of notifications.

    And that's how I get an up-to-date list of beating guns, I haven't found out yet. (The list is needed to close a certain set of notices, e.g. if you're carrying out a massenger, you need to close notices on a specific chat when you open, not remove everything from the list.)
    Their methods are flutter_local_notifications

    / cancel the notification with id value of zero

    await flutterLocalNotificationsPlugin.cancel(0);

    / 0 is your notification id

    Cancelling/deleting all notifications

    await flutterLocalNotificationsPlugin.cancelAll();



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2