TimelineUtils class

TimelineUtils

把时间戳渲染成「刚刚 / x 分钟前 / 昨天 / MM-dd / yyyy-MM-dd」等时间线文案。 文案随 TimelineInfo locale(默认 'en')变化,可用 setLocaleInfo 注册 自定义 locale。所有比较一致地用 isUtc 参数控制按 UTC 还是 local 解读。

Constructors

TimelineUtils()

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 Methods

format(int ms, {int? locTimeMs, String? locale, DayFormat? dayFormat, bool isUtc = false}) → String
format time by millis. dateTime : millis. locDateTime: current time or schedule time. millis. locale: output key. isUtc: 是否按 UTC 解读 ms/locTimeMs(影响日历日判定与格式化输出)。
formatA(int ms, {int? locMs, String formatToday = 'HH:mm', String format = 'yyyy-MM-dd', String languageCode = 'en', bool short = false, bool isUtc = false}) → String
Timeline like QQ.
formatByDateTime(DateTime dateTime, {DateTime? locDateTime, String? locale, DayFormat? dayFormat}) → String
format time by DateTime. dateTime locDateTime: current time or schedule time. locale: output key. isUtc: 是否按 UTC 解读毫秒(线程到日历比较/格式化,默认 false=local)。