我想在指定的时间每天显示通知,并且我已经实现了显示每日通知的代码,但是在我想打电话时没有显示通知是行不通的。我正在使用这个插件链接
当我运行应用程序时,我在控制台上收到此警告,这是屏幕截图

我的代码实现是错误的吗?这是代码
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'dart:async';
class App extends StatefulWidget {
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
showNotification() async{
var time = new Time(3,51, 0);//at 3.30
var androidPlatformChannelSpecifics =
new AndroidNotificationDetails('repeatDailyAtTime channel id',
'repeatDailyAtTime channel name', 'repeatDailyAtTime description');
var iOSPlatformChannelSpecifics =
new IOSNotificationDetails();
var platformChannelSpecifics = new NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.showDailyAtTime(
0,
'Teer Result Time',
'Open The App and check for the Result',
time,
platformChannelSpecifics);
}
@override
void initState() {
// TODO: implement initState
super.initState();
showNotification();
}
@override
Widget build(BuildContext context) {
return Container(
);
}
}
Run Code Online (Sandbox Code Playgroud)
小智 0
我听说过一份报告,其中发生此问题的原因是他们的应用程序尚未迁移到 AndroidX,尽管该错误并不意味着这一点。你看过了吗?请参阅https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility#how-to-migrate-a-flutter-app-to-androidx
| 归档时间: |
|
| 查看次数: |
7156 次 |
| 最近记录: |