toYearMonth method Null safety

void toYearMonth(
  1. YearMonth yearMonth,
  2. {void onError(
    1. RangeError re
    )?}
)

Change another YearMonth within YearMonthRange in CupertinoCalendarMonthView. Otherwise, throws RangeError or call onError if provided

Implementation

void toYearMonth(YearMonth yearMonth,
    {void Function(RangeError re)? onError}) {
  try {
    _stateKey.currentState!._toAnotherYearMonth(yearMonth);
  } on RangeError catch (re) {
    (onError ?? (re) => throw re)(re);
  }
}