formatCurTime function Null safety

String formatCurTime(
  1. {String format = 'HHMMSS',
  2. String divider = ':',
  3. bool is24hr = false}

Formats DateTime into a # string with the time.

Ex. output is "02:08:13 P.M." for is24hr == false. Ex. output is "14:08:13" for is24hr == true.

Can be given 'HH' (hour) 'MM' (minute) 'SS' (second) and 'II' (millisecond) in any order for format (ex. 'HHMMSS' 'MMSSII' 'MM' 'SS' 'HHMM').

Can be given any divider (ex. ':' '.' '/').

Can be given either true or false for 24hr time.


String formatCurTime(
    {String format = 'HHMMSS', String divider = ':', bool is24hr = false}) {
  var now =;
  return formatTime(
      time: now, format: format, divider: divider, is24hr: is24hr);