Showing
1 changed file
with
22 additions
and
22 deletions
| @@ -848,25 +848,41 @@ class RxnDouble extends Rx<double?> { | @@ -848,25 +848,41 @@ class RxnDouble extends Rx<double?> { | ||
| 848 | 848 | ||
| 849 | class RxInt extends Rx<int> { | 849 | class RxInt extends Rx<int> { | 
| 850 | RxInt(int initial) : super(initial); | 850 | RxInt(int initial) : super(initial); | 
| 851 | + | ||
| 852 | + /// Addition operator. | ||
| 853 | + RxInt operator +(int other) { | ||
| 854 | + value = value + other; | ||
| 855 | + return this; | ||
| 856 | + } | ||
| 857 | + | ||
| 858 | + /// Subtraction operator. | ||
| 859 | + RxInt operator -(int other) { | ||
| 860 | + value = value - other; | ||
| 861 | + return this; | ||
| 862 | + } | ||
| 851 | } | 863 | } | 
| 852 | 864 | ||
| 853 | class RxnInt extends Rx<int?> { | 865 | class RxnInt extends Rx<int?> { | 
| 854 | RxnInt([int? initial]) : super(initial); | 866 | RxnInt([int? initial]) : super(initial); | 
| 855 | -} | ||
| 856 | 867 | ||
| 857 | -extension RxIntExt on Rx<int> { | ||
| 858 | /// Addition operator. | 868 | /// Addition operator. | 
| 859 | - Rx<int> operator +(int other) { | ||
| 860 | - value = value + other; | 869 | + RxnInt operator +(int other) { | 
| 870 | + if (value != null) { | ||
| 871 | + value = value! + other; | ||
| 872 | + } | ||
| 861 | return this; | 873 | return this; | 
| 862 | } | 874 | } | 
| 863 | 875 | ||
| 864 | /// Subtraction operator. | 876 | /// Subtraction operator. | 
| 865 | - Rx<int> operator -(int other) { | ||
| 866 | - value = value - other; | 877 | + RxnInt operator -(int other) { | 
| 878 | + if (value != null) { | ||
| 879 | + value = value! - other; | ||
| 880 | + } | ||
| 867 | return this; | 881 | return this; | 
| 868 | } | 882 | } | 
| 883 | +} | ||
| 869 | 884 | ||
| 885 | +extension RxIntExt on Rx<int> { | ||
| 870 | /// Bit-wise and operator. | 886 | /// Bit-wise and operator. | 
| 871 | /// | 887 | /// | 
| 872 | /// Treating both `this` and [other] as sufficiently large two's component | 888 | /// Treating both `this` and [other] as sufficiently large two's component | 
| @@ -1076,22 +1092,6 @@ extension RxIntExt on Rx<int> { | @@ -1076,22 +1092,6 @@ extension RxIntExt on Rx<int> { | ||
| 1076 | } | 1092 | } | 
| 1077 | 1093 | ||
| 1078 | extension RxnIntExt on Rx<int?> { | 1094 | extension RxnIntExt on Rx<int?> { | 
| 1079 | - /// Addition operator. | ||
| 1080 | - Rx<int?>? operator +(int other) { | ||
| 1081 | - if (value != null) { | ||
| 1082 | - value = value! + other; | ||
| 1083 | - return this; | ||
| 1084 | - } | ||
| 1085 | - } | ||
| 1086 | - | ||
| 1087 | - /// Subtraction operator. | ||
| 1088 | - Rx<int?>? operator -(int other) { | ||
| 1089 | - if (value != null) { | ||
| 1090 | - value = value! - other; | ||
| 1091 | - return this; | ||
| 1092 | - } | ||
| 1093 | - } | ||
| 1094 | - | ||
| 1095 | /// Bit-wise and operator. | 1095 | /// Bit-wise and operator. | 
| 1096 | /// | 1096 | /// | 
| 1097 | /// Treating both `this` and [other] as sufficiently large two's component | 1097 | /// Treating both `this` and [other] as sufficiently large two's component | 
- 
Please register or login to post a comment