fromJson static method

TimeUnit? fromJson(
  1. dynamic data
)

Implementation

static TimeUnit? fromJson(dynamic data) {
  if (data == null) return null;
  switch ("$data") {
    case "NANOS":
      return TimeUnit.nanos_;
    case "MICROS":
      return TimeUnit.micros_;
    case "MILLIS":
      return TimeUnit.millis_;
    case "SECONDS":
      return TimeUnit.seconds_;
    case "MINUTES":
      return TimeUnit.minutes_;
    case "HOURS":
      return TimeUnit.hours_;
    case "DAYS":
      return TimeUnit.days_;
    case "WEEKS":
      return TimeUnit.weeks_;
    case "MONTHS":
      return TimeUnit.months_;
    case "YEARS":
      return TimeUnit.years_;
    default:
      return TimeUnit.unknown("$data");
  }
}