Jonny Borges
Committed by GitHub

Merge pull request #1284 from eduardoflorence/rxint-operator

RxInt and RxnInt: adjust operator + and -
... ... @@ -848,25 +848,41 @@ class RxnDouble extends Rx<double?> {
class RxInt extends Rx<int> {
RxInt(int initial) : super(initial);
/// Addition operator.
RxInt operator +(int other) {
value = value + other;
return this;
}
/// Subtraction operator.
RxInt operator -(int other) {
value = value - other;
return this;
}
}
class RxnInt extends Rx<int?> {
RxnInt([int? initial]) : super(initial);
}
extension RxIntExt on Rx<int> {
/// Addition operator.
Rx<int> operator +(int other) {
value = value + other;
RxnInt operator +(int other) {
if (value != null) {
value = value! + other;
}
return this;
}
/// Subtraction operator.
Rx<int> operator -(int other) {
value = value - other;
RxnInt operator -(int other) {
if (value != null) {
value = value! - other;
}
return this;
}
}
extension RxIntExt on Rx<int> {
/// Bit-wise and operator.
///
/// Treating both `this` and [other] as sufficiently large two's component
... ... @@ -1076,22 +1092,6 @@ extension RxIntExt on Rx<int> {
}
extension RxnIntExt on Rx<int?> {
/// Addition operator.
Rx<int?>? operator +(int other) {
if (value != null) {
value = value! + other;
return this;
}
}
/// Subtraction operator.
Rx<int?>? operator -(int other) {
if (value != null) {
value = value! - other;
return this;
}
}
/// Bit-wise and operator.
///
/// Treating both `this` and [other] as sufficiently large two's component
... ...