timeSpanUnitOf function

TimeSpanUnit? timeSpanUnitOf(
  1. dynamic input
)

Implementation

TimeSpanUnit? timeSpanUnitOf(input) {
  if (input is TimeSpanUnit) return input;
  final lc = "$input".toLowerCase().trimEnd("s");
  return TimeSpanUnit.values
      .where((unit) => unit.name == lc)
      .firstWhereOrNull((element) => true);
}