File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,14 @@ void main() {
8989
9090 changeNotifier.notifyListeners ();
9191 });
92+
93+ test ('Emits done when Listenable.addListener throws' , () {
94+ final changeNotifier = ChangeNotifier ()..dispose ();
95+ expect (
96+ changeNotifier.toStream (),
97+ emitsDone,
98+ );
99+ });
92100 });
93101
94102 group ('ValueListenableToStream' , () {
@@ -269,5 +277,25 @@ void main() {
269277 valueNotifier.value = 5 ;
270278 });
271279 });
280+
281+ test (
282+ 'Emits done when ValueNotifier.addListener throws and not replay value' ,
283+ () {
284+ final valueNotifier = ValueNotifier (0 )..dispose ();
285+ expect (
286+ valueNotifier.toValueStream (),
287+ emitsDone,
288+ );
289+ });
290+
291+ test (
292+ 'Emits value and done when ValueNotifier.addListener throws and replay value' ,
293+ () {
294+ final valueNotifier = ValueNotifier (0 )..dispose ();
295+ expect (
296+ valueNotifier.toValueStream (replayValue: true ),
297+ emitsInOrder ([0 , emitsDone]),
298+ );
299+ });
272300 });
273301}
You can’t perform that action at this time.
0 commit comments