operator unary- method Null safety

num? operator unary-()

Negate operator.

Implementation

num? operator -() {
  if (value != null) {
    return -value!;
  }
}