fromMs method

String fromMs (
  1. double ms,
  2. {bool long: false}

Convert from milliseconds to string representation of time

Converts ms, the number of milliseconds to a string representation rounded to the closes smallest measure of time. example:

MS.fromMs(6499); // '6s'
MS.fromMs(6500); // '7s'
MS.fromMs(6501); // '7s'
MS.fromMs(6999); // '7s'

long determines the representation of time measure, if long is true the value above will be '6 seconds'.


static String fromMs(double ms, {bool long = false}) {
  if (_isFinite(ms)) {
    return long ? _fmtLong(ms) : _fmtShort(ms);
  } else {
    throw Exception('val is not a valid number. val=${ms}');