toDateWithFormat method

DateTime? toDateWithFormat(
  1. String format, [
  2. String? locale
])

Parse string to nullable DateTime but with a specific format, e.g, 'd-M-y'.

Implementation

DateTime? toDateWithFormat(String format, [String? locale]) =>
    isEmptyOrNull ? null : DateFormat(format, locale).parse(this!);