copyWith method

OpeningHours copyWith({
  1. List<Period>? periods,
  2. List<String>? weekdayDescriptions,
  3. SecondaryHoursType? secondaryHoursType,
  4. List<SpecialDay>? specialDays,
  5. DateTime? nextOpenTime,
  6. DateTime? nextCloseTime,
  7. bool? openNow,
})

Implementation

OpeningHours copyWith({
  List<Period>? periods,
  List<String>? weekdayDescriptions,
  SecondaryHoursType? secondaryHoursType,
  List<SpecialDay>? specialDays,
  DateTime? nextOpenTime,
  DateTime? nextCloseTime,
  bool? openNow,
}) {
  return OpeningHours(
    periods:
        ((periods?.isNotEmpty ?? false) ? periods : null) ?? this.periods,
    weekdayDescriptions:
        ((weekdayDescriptions?.isNotEmpty ?? false)
            ? weekdayDescriptions
            : null) ??
        this.weekdayDescriptions,
    secondaryHoursType: secondaryHoursType ?? this.secondaryHoursType,
    specialDays:
        ((specialDays?.isNotEmpty ?? false) ? specialDays : null) ??
        this.specialDays,
    nextOpenTime: nextOpenTime ?? this.nextOpenTime,
    nextCloseTime: nextCloseTime ?? this.nextCloseTime,
    openNow: openNow ?? this.openNow,
  );
}