felangel / bloc

A predictable state management library that helps implement the BLoC design pattern
https://bloclibrary.dev
MIT License
11.8k stars 3.39k forks source link

Any RxOperator e.g. debounceTime or mergeWith isn't defined for type Stream #1234

Closed shubhambansal closed 4 years ago

shubhambansal commented 4 years ago

Describe the bug I am trying out an example of flutter_firebase_login and I am getting the following error when trying to use any Rx operator over type Stream in LoginBloc class.

For reference, I have copy-pasted exact same code in my file. https://github.com/felangel/bloc/blob/master/examples/flutter_firebase_login/lib/login/bloc/login_bloc.dart

I have defined the following dependencies in pubspec.yaml file

rxdart: ^0.23.1 flutter_bloc: ^4.0.0 #Bloc architecture pattern meta: ^1.1.6 equatable: ^1.1.1

I am not sure what exactly is missing in order to usee Rx operator with Stream. I'd like to thank in advance for any suggestion to fix this issue.

narcodico commented 4 years ago

Hi 👋

You might have some incompatibilities between your packages, pay attention to output console for that. Try using the latest version of rxdart which is 0.24.1

felangel commented 4 years ago

Hi @shubhambansal 👋 You need to add rxdart as a dependency as @RollyPeres mentioned and make sure you’ve imported package:rxdart/rxdart.dart 👍

shubhambansal commented 4 years ago

Hi @RollyPeres Thanks for the answer. @felangel Thanks it's was a rxdart import issue. Adding package:rxdart/rxdart.dart solves my issue. Somehow it was not auto imported by my IDE (i.e. Android Studio)