Jonatas

added value to RxInterface

... ... @@ -13,12 +13,6 @@ class _RxImpl<T> implements RxInterface<T> {
HashMap<Stream<T>, StreamSubscription>();
T _value;
T get value {
if (getObs != null) {
getObs.addListener(subject.stream);
}
return _value;
}
/// Common to all Types [T], this operator overloading is using for
/// assignment, same as rx.value
... ... @@ -143,6 +137,13 @@ class _RxImpl<T> implements RxInterface<T> {
subject.add(_value);
}
T get value {
if (getObs != null) {
getObs.addListener(subject.stream);
}
return _value;
}
Stream<T> get stream => subject.stream;
StreamSubscription<T> listen(void Function(T) onData,
... ...
... ... @@ -17,6 +17,10 @@ abstract class RxInterface<T> {
bool get canUpdate;
set value(T val);
T get value;
/// Closes the stream
void close() => subject?.close();
... ... @@ -75,7 +79,7 @@ abstract class DisposableInterface {
/// Or dispose objects that can potentially create some memory leaks,
/// like TextEditingControllers, AnimationControllers.
/// Might be useful as well to persist some data on disk.
void onClose() async {}
Future<void> onClose() async {}
}
/// Used like [SingleTickerProviderMixin] but only with Get Controllers.
... ...
... ... @@ -48,7 +48,7 @@ class GetxController extends DisposableInterface {
void onReady() async {}
@override
void onClose() async {}
Future<void> onClose() async {}
}
class GetBuilder<T extends GetxController> extends StatefulWidget {
... ...