setSnoozePeriod method Null safety
Sets snooze period enable
with start and end date.
Implementation
Future<void> setSnoozePeriod({
required bool enable,
DateTime? startDate,
DateTime? endDate,
}) async {
if (enable) {
if (startDate == null || endDate == null) throw InvalidParameterError();
if (endDate.difference(startDate).inSeconds < 0) {
throw InvalidParameterError();
}
if (endDate.difference(DateTime.now()).inSeconds < 0) {
throw InvalidParameterError();
}
}
return _int.api.send(UserSnoozePeriodSetRequest(
enable: enable,
startDate: startDate,
endDate: endDate,
));
}