format static method
Formats a DateTime using the given pattern and optional locale.
Example:
final formatted = DateFormatter.format(
DateTime.now(),
'dd/MM/yyyy HH:mm',
locale: 'it',
);
Implementation
static String format(DateTime date, String pattern, {String? locale}) {
final formatter = DateFormat(pattern, locale);
return formatter.format(date);
}