formatTime method
Format time in milliseconds
Implementation
String formatTime() {
final timeInMillis = this;
if (timeInMillis < 0) {
return "-1 ms";
}
if (timeInMillis <= _secondAsMillisecond) {
return "$timeInMillis ms";
}
if (timeInMillis <= _minuteAsMillisecond) {
return "${(timeInMillis / _secondAsMillisecond).toStringAsFixed(2)} s";
}
final duration = Duration(milliseconds: timeInMillis);
return "${duration.inMinutes} min ${(duration.inSeconds.remainder(60))} s "
"${duration.inMilliseconds.remainder(1000)} ms";
}