本地通知颤抖:错误“未处理的异常:NoSuchMethodError:方法'show'被调用为null。”

时间:2020-09-09 10:17:19

标签: android flutter dart push-notification

如何在不单击按钮的情况下创建通知? 打开应用程序时如何初始化出现通知?

 String groupKey = 'com.android.example.WORK_EMAIL';
    String groupChannelId = 'grouped channel id';
    String groupChannelName = 'grouped channel name';
    String groupChannelDescription = 'grouped channel description';
    AndroidNotificationDetails firstNotificationAndroidSpecifics =
    AndroidNotificationDetails(
      groupChannelId, groupChannelName,
      groupChannelDescription,
      importance: Importance.Max,
      priority: Priority.High,
      groupKey: groupKey,
      style: AndroidNotificationStyle.BigText,

      styleInformation: BigTextStyleInformation(''),
    );
    final AndroidNotificationDetails android = AndroidNotificationDetails(
      'ch_ID',
      'Ch_Name',
      'ch_Description',
      priority: Priority.High,
      importance: Importance.Max,

      // add this line in your code
      styleInformation: BigTextStyleInformation(''),
    );
    NotificationDetails firstNotificationPlatformSpecifics =
    NotificationDetails(
      firstNotificationAndroidSpecifics, null,);
    flutterLocalNotificationsPlugin.show(
        1, 'Confirmation ',
        'Hello' , firstNotificationPlatformSpecifics);

如何快速启动通知?

0 个答案:

没有答案