formatDate static method
Formats a non-null date using the given format.
Returns fallback if formatting fails.
Implementation
static String formatDate(
DateTime date, {
String format = defaultFormat,
String? locale,
}) {
try {
return DateFormat(format, locale).format(date);
} catch (_) {
return fallback;
}
}