BetweenFormatter class

时长格式化器,用于格式化输出两个日期相差的时长
根据{@link Level}不同,调用{@link #format()}方法后返回类似于:

  • XX小时XX分XX秒
  • XX天XX小时
  • XX月XX天XX小时

Constructors

BetweenFormatter({required int betweenMs, required Level level, int levelMaxCount = 0})

Properties

betweenMs int
时长毫秒数
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
level Level
格式化级别,按照天、小时、分、秒、毫秒分为5个等级,根据传入等级,格式化到相应级别
getter/setter pair
levelMaxCount int
格式化级别的最大个数
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

format() String
格式化日期间隔输出
getBetweenMs() int
获得 时长毫秒数
getLevel() Level
获得 格式化级别
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setBetweenMs(int betweenMs) → void
设置 时长毫秒数
setLevel(Level level) → void
设置格式化级别
toString() String
A string representation of this object.
override

Operators

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