Add abs and isNegative to Duration #9789
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-core
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @seaneagan
abs is especially useful on the result of DateTime.difference
isNegative is useful for precondition checking
currently one has to do:
new Duration(microseconds: duration.inMicroseconds.abs())
duration.inMicroseconds.isNegative
The text was updated successfully, but these errors were encountered: