formatTime method

String formatTime({
  1. String pattern = 'hh:mm:ss a',
})

Implementation

String formatTime({String pattern = 'hh:mm:ss a'}) {
  if (this == null) {
    return ""; // Return empty string if DateTime is null
  }
  return DateFormat(pattern).format(this!);
}