formatTimeFromDt function Null safety

String formatTimeFromDt(
  1. DateTime? dateTime
)

Extract time from DateTime and return a String having this format : kk:mm

Implementation

String formatTimeFromDt(DateTime? dateTime) {
  if (dateTime==null) return "";
  final f = new DateFormat('kk:mm');
  return f.format(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, dateTime.hour, dateTime.minute));
}