getNumberOfDatesInMonth method Null safety

int? getNumberOfDatesInMonth()

returns the number of dates in the month

Implementation

int? getNumberOfDatesInMonth() {
  final int totalYear = year - 1;
  final int totalMonths = (totalYear * 12) + 1 + (month - 1);
  final int i = totalMonths - 16260;
  if (_kDateCollection.length > i - 1 && i > 0) {
    return _kDateCollection[i] - _kDateCollection[i - 1];
  }

  /// Return null when the date value is not valid.
  /// Valid date should be between 1356 AH (14 March 1937 CE) to
  /// 1500 AH (16 November 2077 CE).
  return null;
}