getNextYearMonth function
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.forDeveloper(
traceMarker: 'getNextYearMonth',
reasonCode: AppErrorReasonCode.toBeDetermined,
message: 'Year out of range: $nextYear',
);
}
return YearMonth(year: nextYear, month: nextMonth);
}