convertTimeOfDay function

  1. @Deprecated('Use .toDisplayTime extension instead.')
String convertTimeOfDay(
  1. TimeOfDay timeOfDay, {
  2. String? timeFormat,
})

convertTimeOfDay method this method will convert time of day to date time format

Implementation

@Deprecated('Use .toDisplayTime extension instead.')
String convertTimeOfDay(TimeOfDay timeOfDay, {String? timeFormat}) {
  final now = DateTime.now();
  final DateTime dateTime = DateTime(now.year, now.month, now.day, timeOfDay.hour, timeOfDay.minute);

  /// calling format date time method to convert time of day for display
  return formatDateTime(dateTime.toString(), newDateTimeFormat: timeFormat ?? kTimeDisplayFormat);
}