How to disable Push notifications programmatically on Flutter without no need to go to Settings -> Push Notifications of the app?

This package notification_permissions only get and request NotificationPermissions.

And FirebaseMessaging can't disable Push notifications programmatically as well.

Right now I use the package app_settings which opens the Settings of the app.

In the video I do it manually but I want to do it programmatically.

enter image description here


Solution 1: user18309290

Use deleteToken which invalidates the current token and getToken again to get a new one when enabling.

Removes access to an FCM token previously authorized. Messages sent by the server to this token will fail.