Jonatas

add type to workers

@@ -160,6 +160,16 @@ class RxBool extends _RxImpl<bool> { @@ -160,6 +160,16 @@ class RxBool extends _RxImpl<bool> {
160 RxBool([bool initial]) { 160 RxBool([bool initial]) {
161 _value = initial; 161 _value = initial;
162 } 162 }
  163 +
  164 + bool operator &(bool other) => other && value;
  165 +
  166 + bool operator |(bool other) => other || value;
  167 +
  168 + bool operator ^(bool other) => !other == value;
  169 +
  170 + String toString() {
  171 + return value ? "true" : "false";
  172 + }
163 } 173 }
164 174
165 class RxDouble extends _RxImpl<double> { 175 class RxDouble extends _RxImpl<double> {
@@ -3,7 +3,7 @@ import 'package:get/get.dart'; @@ -3,7 +3,7 @@ import 'package:get/get.dart';
3 import '../rx_core/rx_interface.dart'; 3 import '../rx_core/rx_interface.dart';
4 import 'utils/debouncer.dart'; 4 import 'utils/debouncer.dart';
5 5
6 -Worker ever(RxInterface listener, Function(dynamic) callback, 6 +Worker ever<T>(RxInterface<T> listener, Function(T) callback,
7 {bool condition = true}) { 7 {bool condition = true}) {
8 StreamSubscription sub = listener.subject.stream.listen((event) { 8 StreamSubscription sub = listener.subject.stream.listen((event) {
9 if (condition) callback(event); 9 if (condition) callback(event);