I need to disable the notification sounds on a button click. I have used the [flutter_local_notification][1] package. What I did that the boolean value from the button click has been stored in the local DB. When a push notification comes, it will fetch from the local db to find whether the sound is enabled and assign that value to play sound.
bool isSoundEnabled = await SharedPreferanceClass.getNotifiationSound();
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
'channel_id',
'channel_name',
enableLights: true,
enableVibration: true,
sound: isSoundEnabled ? const RawResourceAndroidNotificationSound("notification") : null,
playSound: isSoundEnabled,
icon: "@mipmap/ic_launcher",
styleInformation: const BigPictureStyleInformation(FilePathAndroidBitmap(
"assets/splash/splash.bmp",
),
hideExpandedLargeIcon: true,
),
importance: Importance.high,
priority: Priority.high,
);
How can I implement this feature or is there anything I did wrong in the above code [1]: https://pub.dev/packages/flutter_local_notifications/install