我正在开发一个使用flutter_local_notifications的 flutter 应用程序,以便向用户发送每日通知。目前,在我的模拟器上运行 flutter 应用程序时,出现以下错误:
E / flutter(9973):[错误:flutter/runtime/dart_vm_initializer.cc(41)]未处理的异常:PlatformException(exact_alarms_not_permission,不允许精确警报,null,null)
并且应用程序冻结。这是导致错误的代码:
Future<void> repeatNotification() async {
const AndroidNotificationDetails androidNotificationDetails =
AndroidNotificationDetails(
'repeating channel id', 'repeating channel name',
channelDescription: 'repeating description');
const NotificationDetails notificationDetails =
NotificationDetails(android: androidNotificationDetails);
// Create a list of greetings
List<String> greetings = [
"Hi!",
"Hey there!",
"Hello!",
"Hi there!",
"What's up?",
"Howdy!",
];
// Create a list of daily check-in messages
List<String> checkInMessages = [
"It's time for your daily check in.",
"Don't forget to check in today.", …Run Code Online (Sandbox Code Playgroud)