transform method

String? transform(
  1. dynamic value, [
  2. String pattern = 'mediumDate'
])

Implementation

String? transform(dynamic value, [String pattern = 'mediumDate']) {
  if (value == null) return null;
  if (!supports(value)) {
    throw InvalidPipeArgumentException(DatePipe, value);
  }
  if (value is num) {
    value = DateTime.fromMillisecondsSinceEpoch(unsafeCast(value));
  }
  if (DatePipe._ALIASES.containsKey(pattern)) {
    pattern = DatePipe._ALIASES[pattern]!;
  }
  return _formatDate(unsafeCast(value), Intl.defaultLocale, pattern);
}