getTimeFromDate static method
Extracts and formats the time from a nullable DateTime object.
timeFormat: The desired output format, defaults to "hh:mm a'".
Returns an empty string if the date is null or on error.
Implementation
static String getTimeFromDate(
DateTime? date, {
String timeFormat = "hh:mm a'",
}) {
try {
return DateFormat(timeFormat).format(date!).toUpperCase();
} catch (e) {
return '';
}
}