periodicallyShowWithDuration method

  1. @override
Future<void> periodicallyShowWithDuration(
  1. int id,
  2. String? title,
  3. String? body,
  4. Duration repeatDurationInterval, {
  5. AndroidNotificationDetails? notificationDetails,
  6. String? payload,
  7. AndroidScheduleMode scheduleMode = AndroidScheduleMode.exact,
})
override

Periodically show a notification using the specified custom duration interval.

For example, specifying a 5 minutes repeat duration interval means the first time the notification will be an 5 minutes after the method has been called and then every 5 minutes after that.

repeatDurationInterval must be at least one minute.

Implementation

@override
Future<void> periodicallyShowWithDuration(
  int id,
  String? title,
  String? body,
  Duration repeatDurationInterval, {
  AndroidNotificationDetails? notificationDetails,
  String? payload,
  AndroidScheduleMode scheduleMode = AndroidScheduleMode.exact,
}) async {
  validateId(id);
  validateRepeatDurationInterval(repeatDurationInterval);
  await _channel
      .invokeMethod('periodicallyShowWithDuration', <String, Object?>{
    'id': id,
    'title': title,
    'body': body,
    'calledAt': clock.now().millisecondsSinceEpoch,
    'repeatIntervalMilliseconds': repeatDurationInterval.inMilliseconds,
    'platformSpecifics':
        _buildPlatformSpecifics(notificationDetails, scheduleMode),
    'payload': payload ?? '',
  });
}