formatWithPattern static method
Implementation
static String? formatWithPattern(DateTime? dateTime, String pattern) {
if (dateTime == null) return null;
try {
final formatter = DateFormat(pattern);
return formatter.format(dateTime);
} catch (e) {
return dateTime.toIso8601String();
}
}