Skip to main content

New site for Dart news and articles

For the latest Dart news, visit our new blog at .

Negate() changes to -() soon

Today, Kasper Lund gave dartisans a head's up about an upcoming breaking change. Kasper writes:

We're getting rid of operator negate in favor of the unary operator -. 
If you have code like this: 

   operator negate() => ... 

now would be a great time to change that to: 

   operator -() => ... 

I expect that we will turn off the support for negate within a few days.

Why make this change? We didn't want developers to see negate() and think they can actually call object.negate(). We hope -() makes it more obvious.

As always, you can join the discussion at the Dart mailing list or ask questions on Stack Overflow. Thanks for trying Dart!