getMillisecondsAsUnit function

double? getMillisecondsAsUnit(
  1. int? ms,
  2. Object? unit, [
  3. double? def
])

Implementation

double? getMillisecondsAsUnit(int? ms, Object? unit, [double? def]) {
  if (ms == null) return def;
  if (ms == 0) return 0;

  if (unit == null) return def;

  var unitParsed = parseUnit(unit);
  if (unitParsed == null) return def;

  var unitMs = _getUnitMilliseconds(unitParsed)!;
  var res = ms / unitMs;

  return res;
}