from static method

Time? from(
  1. Object? o
)

Implementation

static Time? from(Object? o) {
  if (o == null) return null;
  if (o is Time) return o;

  if (o is Duration) return Time.fromDuration(o);
  if (o is DateTime) return Time.fromDateTime(o);
  if (o is List<int>) return Time.fromBytes(o);

  if (o is int) return Time.fromMilliseconds(o);

  if (o is Map) {
    return Time(
      TypeParser.parseInt(o['hour'], 0)!,
      TypeParser.parseInt(o['minute'], 0)!,
      TypeParser.parseInt(o['second'], 0)!,
      TypeParser.parseInt(o['millisecond'], 0)!,
      TypeParser.parseInt(o['microsecond'], 0)!,
    );
  }

  return Time.parse(o.toString());
}