Jonatas

mod operator + and -

@@ -3,10 +3,6 @@ part of 'rx_impl.dart'; @@ -3,10 +3,6 @@ part of 'rx_impl.dart';
3 /// Base Rx class for all num Rx's. 3 /// Base Rx class for all num Rx's.
4 class _BaseRxNum<T extends num> extends _RxImpl<T> { 4 class _BaseRxNum<T extends num> extends _RxImpl<T> {
5 /// Addition operator. */ 5 /// Addition operator. */
6 - num operator +(num other) => value + other;  
7 -  
8 - /// Subtraction operator.  
9 - num operator -(num other) => value - other;  
10 6
11 /// Multiplication operator. 7 /// Multiplication operator.
12 num operator *(num other) => value * other; 8 num operator *(num other) => value * other;
@@ -270,7 +266,18 @@ class _BaseRxNum<T extends num> extends _RxImpl<T> { @@ -270,7 +266,18 @@ class _BaseRxNum<T extends num> extends _RxImpl<T> {
270 value.toStringAsPrecision(precision); 266 value.toStringAsPrecision(precision);
271 } 267 }
272 268
273 -class RxNum extends _BaseRxNum<num> {} 269 +class RxNum extends _BaseRxNum<num> {
  270 + num operator +(num other) {
  271 + value += other;
  272 + return value;
  273 + }
  274 +
  275 + /// Subtraction operator.
  276 + num operator -(num other) {
  277 + value -= other;
  278 + return value;
  279 + }
  280 +}
274 281
275 class RxDouble extends _BaseRxNum<double> { 282 class RxDouble extends _BaseRxNum<double> {
276 RxDouble([double initial]) { 283 RxDouble([double initial]) {
@@ -278,10 +285,16 @@ class RxDouble extends _BaseRxNum<double> { @@ -278,10 +285,16 @@ class RxDouble extends _BaseRxNum<double> {
278 } 285 }
279 286
280 /// Addition operator. 287 /// Addition operator.
281 - double operator +(num other) => value + other; 288 + RxDouble operator +(num other) {
  289 + value += other;
  290 + return this;
  291 + }
282 292
283 /// Subtraction operator. 293 /// Subtraction operator.
284 - double operator -(num other) => value - other; 294 + RxDouble operator -(num other) {
  295 + value -= other;
  296 + return this;
  297 + }
285 298
286 /// Multiplication operator. 299 /// Multiplication operator.
287 double operator *(num other) => value * other; 300 double operator *(num other) => value * other;
@@ -383,6 +396,18 @@ class RxInt extends _BaseRxNum<int> { @@ -383,6 +396,18 @@ class RxInt extends _BaseRxNum<int> {
383 value = initial; 396 value = initial;
384 } 397 }
385 398
  399 + /// Addition operator.
  400 + RxInt operator +(int other) {
  401 + value += other;
  402 + return this;
  403 + }
  404 +
  405 + /// Subtraction operator.
  406 + RxInt operator -(int other) {
  407 + value -= other;
  408 + return this;
  409 + }
  410 +
386 /// Bit-wise and operator. 411 /// Bit-wise and operator.
387 /// 412 ///
388 /// Treating both `this` and [other] as sufficiently large two's component 413 /// Treating both `this` and [other] as sufficiently large two's component