convertStringToDate function

DateTime convertStringToDate({
  1. required String dateTimeString,
  2. required String format,
})

convertStringToDate converts a valid date time string to a DateTime object

Implementation

DateTime convertStringToDate(
    {required String dateTimeString, required String format}) {
  return DateFormat(format).parse(dateTimeString);
}