我正在使用flutter_local_notifications,点击通知时需要导航到特定页面。
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
void initState() {
flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
var android = new AndroidInitializationSettings('@mipmap/ic_launcher');
var iOS = new IOSInitializationSettings();
var initSetttings = new InitializationSettings(android, iOS);
flutterLocalNotificationsPlugin.initialize(initSetttings,
onSelectNotification: onSelectNotification);
super.initState();
}
Future<dynamic> onSelectNotification(String payload) async {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => NoteDetails(note, fft,
ffn, widget.scaffoldKey, confirmUpdateListView)));
return true;
}
如果应用为On
,则可以正常运行,但是如果在应用为Off
时推送通知,然后单击它,则会显示黑屏。
那该怎么办?哪个是启动应用程序的正确方法?
预先感谢