toTimeString method

String? toTimeString({
  1. bool withSeconds = false,
})

Format DateTime to toTimeString - HH:mm or HH:mm:ss

Implementation

String? toTimeString({bool withSeconds = false}) {
  if (this == null) return null;
  String format = "HH:mm";
  if (withSeconds) format = "HH:mm:ss";
  return intl.DateFormat(format, _locale).format(this!);
}