final subject = BehaviorSubject<int>();
final doublesValueStream = subject.map((v) => v * 2).shareValueSeeded(10);
await Future.delayed(const Duration(milliseconds: 100));
subject.add(100);
await Future.delayed(const Duration(milliseconds: 100));
print(doublesValueStream.value);
From seeing the implementation of shareValue I assume it should listen to the source stream and provide value via the underlying subject. However, the above example results in 10 being printed instead of 200. Is there a way to achieve this result where the resulting ValueStream would contain up-to-date value?
As expected
final subject = BehaviorSubject<int>();
final doublesValueStream = subject.map((v) => v * 2).shareValueSeeded(10)..listen((event) {});
await Future.delayed(const Duration(milliseconds: 100));
subject.add(100);
await Future.delayed(const Duration(milliseconds: 100));
print(doublesValueStream.value);
Works as expected.
If this is a bug I am willing to look into the fix during the weekend, but need confirmation if this is a bug or expected behavior
From seeing the implementation of shareValue I assume it should listen to the source stream and provide value via the underlying subject. However, the above example results in 10 being printed instead of 200. Is there a way to achieve this result where the resulting ValueStream would contain up-to-date value?
As expected
Works as expected. If this is a bug I am willing to look into the fix during the weekend, but need confirmation if this is a bug or expected behavior
rxdart: ^0.27.7 is used