Bad state: You cannot close the subject while items are being added from addStream in flutter

后端 未结 2 1887
栀梦
栀梦 2021-01-05 00:41

I am using RxDart to observe changes and update the UI accordingly. When the app launches I am making a network call and successfully getting the data, observe the changes a

2条回答
  •  误落风尘
    2021-01-05 01:31

    You can also resolve it be replacing:

    MovieDetailBloc() {
      _movieId.stream.transform(_itemTransformer()).pipe(_trailers);
    }
    

    with

    MovieDetailBloc() {
      _movieId.stream.transform(_itemTransformer()).listen((data) {
        if (!_categories.isClosed) {
          _trailers.add(data);
        }
      });
    }
    

提交回复
热议问题