setObject method

Hora setObject(
  1. Map<String, Object?> map
)

Sets components specified by a map.

Unlike addObject, this sets absolute values rather than adding.

Implementation

Hora setObject(Map<String, Object?> map) {
  final normalized = _normalizeObjectMap(
    map,
    supportedKeys: _setSupportedKeys,
    operation: 'setObject',
  );
  return copyWith(
    year: _readInt(normalized, [DateTimeKeys.year, DateTimeKeys.years]),
    month: _readInt(normalized, [DateTimeKeys.month, DateTimeKeys.months]),
    day: _readInt(
      normalized,
      [DateTimeKeys.day, DateTimeKeys.days, DateTimeKeys.date],
    ),
    hour: _readInt(normalized, [DateTimeKeys.hour, DateTimeKeys.hours]),
    minute: _readInt(
      normalized,
      [DateTimeKeys.minute, DateTimeKeys.minutes],
    ),
    second: _readInt(
      normalized,
      [DateTimeKeys.second, DateTimeKeys.seconds],
    ),
    millisecond: _readInt(
      normalized,
      [DateTimeKeys.millisecond, DateTimeKeys.milliseconds],
    ),
    microsecond: _readInt(
      normalized,
      [DateTimeKeys.microsecond, DateTimeKeys.microseconds],
    ),
  );
}