我需要禁用按钮点击时的通知声音.我已经使用了[Ffltter_LOCAL_NOTIFICATION][1]包.我所做的是将来自按钮点击的布尔值存储在本地数据库中.当推送通知到来时,它将从本地数据库获取,以确定声音是否被启用,并将该值分配给播放声音.
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,
);
我如何实现此功能,或者我在上面的代码中是否做错了什么 [1]:https://pub.dev/packages/flutter_local_notifications/install