activateNotification method

  1. @override
Future<void> activateNotification({
  1. required String time,
  2. required PayLoadModel payLoad,
  3. ChannelModel? channel,
})
override

Implementation

@override
Future<void> activateNotification({required String time, required PayLoadModel payLoad, ChannelModel? channel }) async
{
  try{
    ChannelModel chan = channel??ChannelModel();
    await flutterLocalNotificationsPlugin.zonedSchedule(
        payLoad.notificationId,
        payLoad.titre,//'msg_do_not_forget_to_read_bible_plan'.tr,// (${'label_stay_on_track'.tr})',
        payLoad.description,// ${payLoad.description.toLowerCase()}',

        payload: payLoad.jsonEncodeString,
        scheduledDateTime(timeReminder: time),
        NotificationDetails(
            android: AndroidNotificationDetails(
              chan.id,
              chan.name,
              channelDescription: chan.description,
              // actions: <AndroidNotificationAction>[
              //   AndroidNotificationAction('id_1', 'Action 1'),
              //   AndroidNotificationAction('id_2', 'Action 2'),
              //   AndroidNotificationAction('id_3', 'Action 3'),
              // ],
            ),
            iOS: DarwinNotificationDetails()
        ),
        androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
        matchDateTimeComponents: DateTimeComponents.time
    );
  }catch(ex, trace){
    logError(ex, trace: trace, position: 'activateNotification');
  }
}