parseDate static method

CalendarDateTime? parseDate(
  1. String date
)

Implementation

static CalendarDateTime? parseDate(String date) {
  final datePart = date.split("-");

  try {
    return CalendarDateTime(
      year: int.parse(datePart[0]),
      month: int.parse(datePart[1]),
      day: int.parse(datePart[2]),
    );
  } on Exception catch (e) {
    print("${e.toString()}");
    return null;
  }
}