getNextYearMonth function

YearMonth getNextYearMonth(
  1. YearMonth yearMonth
)

Implementation

YearMonth getNextYearMonth(YearMonth yearMonth) {
  final year = yearMonth.year;
  final month = yearMonth.month;
  final nextYear = month == 12 ? year + 1 : year;
  final nextMonth = month == 12 ? 1 : month + 1;
  if (nextYear > YearMonth.maxYear) {
    throw AppError(
      messageForDeveloper: 'getNextYearMonth: Year out of range: $nextYear',
      messageForUser: '年の値が範囲外です',
      originalMessage: null,
        statusCode: null,
    );
  }
  return YearMonth(year: nextYear, month: nextMonth);
}