参数类型' string'可以将参数类型分配给androidNotificationund'
这是DART分析信息:
error: The argument type 'String' can't be assigned to the parameter type 'AndroidNotificationSound'. (argument_type_not_assignable at [mediminder] lib/src/ui/new_entry/new_entry.dart:335)
和文件“ new_entry.dart”仍然从这里出发:
Future _showNotificationWithSound() async {
var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
'your channel id', 'your channel name',
sound: 'sneezenotification',
importance: Importance.max,
priority: Priority.high);
var platformChannelSpecifics = new NotificationDetails(
android: androidPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
0,
'New Post',
'How to Show Notification in Flutter',
platformChannelSpecifics,
payload: 'Custom_Sound',
);
}
错误在线
声音中:'sneezenotification'。 注意:我已经添加了sneezn Notification.mp3在Android中
this is the dart analyses info:
error: The argument type 'String' can't be assigned to the parameter type 'AndroidNotificationSound'. (argument_type_not_assignable at [mediminder] lib/src/ui/new_entry/new_entry.dart:335)
and the file "new_entry.dart" still te same original one from here:
Future _showNotificationWithSound() async {
var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
'your channel id', 'your channel name',
sound: 'sneezenotification',
importance: Importance.max,
priority: Priority.high);
var platformChannelSpecifics = new NotificationDetails(
android: androidPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
0,
'New Post',
'How to Show Notification in Flutter',
platformChannelSpecifics,
payload: 'Custom_Sound',
);
}
the error is in the line
sound: 'sneezenotification'.
Note: I already added sneeze notification.mp3 in android>app>res>raw
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这样更改并更改“ channel_id 3”的工作
Change like this and change "channel_id 3" its work for me