parse static method

DateTime parse(
  1. String dateString, {
  2. String? pattern,
  3. String locale = 'en_US',
  4. bool isUTC = false,
})

Transforms a date that follows a pattern from a String representation to a DateTime object

Implementation

static DateTime parse(
  String dateString, {
  String? pattern,
  String locale = 'en_US',
  bool isUTC = false,
}) {
  initializeDateFormatting();
  return pattern == null
      ? DateTime.parse(dateString)
      : DateFormat(pattern, locale).parse(dateString, isUTC);
}