Clock class

시간 처리를 위한 유틸리티 클래스입니다.

이 클래스는 애플리케이션에서 사용되는 시간 처리를 중앙화하고, 테스트 시에 시간을 모킹할 수 있도록 지원합니다.

사용 예시:

// 기본 사용
DateTime now = Clock.now();

// 테스트에서 시간 모킹
Clock.dateTimeResolver = () => DateTime(2024, 1, 1);

Constructors

Clock()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

dateTimeResolver CurrentDateTimeResolver
현재 시간을 반환하는 함수입니다. 기본값은 실제 시스템 시간을 반환하지만, 테스트나 특수한 상황에서 다른 시간을 반환하도록 변경할 수 있습니다.
getter/setter pair

Static Methods

now() DateTime
현재 시간을 반환합니다. 설정된 dateTimeResolver를 사용하여 현재 시간을 가져옵니다.