Jonatas

update to 3.25.3

  1 +## [3.25.3]
  2 +- Fix bindStream error 'Object.noSuchMethod'.
  3 +
1 ## [3.25.2] 4 ## [3.25.2]
2 - Improved Workers system to accept a list of works 5 - Improved Workers system to accept a list of works
3 6
@@ -116,7 +116,9 @@ mixin RxObjectMixin<T> on NotifyManager<T> { @@ -116,7 +116,9 @@ mixin RxObjectMixin<T> on NotifyManager<T> {
116 /// Closing the subscription will happen automatically when the observer 116 /// Closing the subscription will happen automatically when the observer
117 /// Widget ([GetX] or [Obx]) gets unmounted from the Widget tree. 117 /// Widget ([GetX] or [Obx]) gets unmounted from the Widget tree.
118 void bindStream(Stream<T> stream) { 118 void bindStream(Stream<T> stream) {
119 - _subscriptions[subject].add(stream.listen((va) => value = va)); 119 + final listSubscriptions =
  120 + _subscriptions[subject] ??= <StreamSubscription>[];
  121 + listSubscriptions.add(stream.listen((va) => value = va));
120 } 122 }
121 } 123 }
122 124
1 name: get 1 name: get
2 description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. 2 description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
3 -version: 3.25.2 3 +version: 3.25.3
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment:
  1 +import 'dart:async';
  2 +
1 import 'package:flutter_test/flutter_test.dart'; 3 import 'package:flutter_test/flutter_test.dart';
2 import 'package:get/get.dart'; 4 import 'package:get/get.dart';
3 5
@@ -77,4 +79,20 @@ void main() { @@ -77,4 +79,20 @@ void main() {
77 await Future.delayed(Duration(milliseconds: 100)); 79 await Future.delayed(Duration(milliseconds: 100));
78 expect(5, result); 80 expect(5, result);
79 }); 81 });
  82 +
  83 + test('bindStream test', () async {
  84 + var count = 0;
  85 + final controller = StreamController<int>();
  86 + final rx = 0.obs;
  87 +
  88 + rx.listen((value) {
  89 + count = value;
  90 + });
  91 + rx.bindStream(controller.stream);
  92 + expect(count, 0);
  93 + controller.add(555);
  94 +
  95 + await Future.delayed(Duration.zero);
  96 + expect(count, 555);
  97 + });
80 } 98 }