date method Null safety

DateFormat date(
  1. [String? pattern,
  2. String? desiredLocale]
)

Return a new date format using the specified pattern. If desiredLocale is not specified, then we default to locale.

Implementation

DateFormat date([String? pattern, String? desiredLocale]) {
  var actualLocale = (desiredLocale == null) ? locale : desiredLocale;
  return DateFormat(pattern, actualLocale);
}