Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A value of type 'StreamSink<dynamic>' can't be returned from the function 'chuckDataSink' because it has a return type of 'StreamSink<Response<chuckResponse>>?'. #5

Open
ZoraizEjaz opened this issue Apr 16, 2021 · 1 comment

Comments

@ZoraizEjaz
Copy link

Getting this issue in Flutter 2. Null Safety

@ppusapati
Copy link

ppusapati commented Nov 18, 2021

This is how I resolved.

class ChuckBloc {
  ChuckRepository ? _chuckRepository;
  StreamController<Response<chuckResponse>> _chuckDataController = StreamController<Response<chuckResponse>>();
  bool ? _isStreaming;

  StreamSink<Response<chuckResponse>> get chuckDataSink =>
      _chuckDataController.sink;

  Stream<Response<chuckResponse>> get chuckDataStream =>
      _chuckDataController.stream;

  ChuckBloc(String category) {
    _chuckDataController = StreamController<Response<chuckResponse>>();
    _chuckRepository = ChuckRepository();
    _isStreaming = true;
    fetchChuckyJoke(category);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants