operator unary- method

Duration operator unary- ()

Creates a new Duration with the opposite direction of this Duration.

The returned Duration has the same length as this one, but will have the opposite sign (as reported by isNegative) as this one.

Implementation

// Using subtraction helps dart2js avoid negative zeros.
Duration operator -() => Duration._microseconds(0 - _duration);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/Duration/operator_unary_minus.html