Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter error while triying to implement BLoC from youtube-search-tutorial

Tags:

flutter

bloc

I'm having trouble implementing BLoC in flutter, i followed this tutorial: https://github.com/ResoCoder/youtube-search-flutter-bloc

But i get the following compiler message that i haven't been able to debug:

Compiler message:
file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/bloc-0.8.4/lib/src/bloc.dart:24:44: Error: No named parameter with the name 'seedValue'.
_stateSubject = BehaviorSubject<State>(seedValue: initialState);
                                       ^^^^^^^^^
file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/rxdart-0.21.0/lib/src/subjects/behavior_subject.dart:49:11: Context: Found this candidate, but the arguments don't match.
factory BehaviorSubject({
        ^
Compiler failed on /home/rafa/AndroidStudioProjects/news/lib/main.dart
Finished with error: Gradle task assembleDebug failed with exit code 1

Im using:

Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (12 days ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

Any ideas on how to fix this error? Thanks!

like image 352
Rafa He So Avatar asked Feb 26 '19 17:02

Rafa He So


2 Answers

I found the issue, rxdart: 0.21.0 has been refactored and breaks bloc 0.8.4, in order to fix this problem add rxdart: 0.20.0 as a dependency to pubspec.loc

like image 60
Rafa He So Avatar answered Sep 24 '22 18:09

Rafa He So


I was able to fix this by using the most recent flutter_bloc dependency, which is currently flutter_bloc: ^0.8.0.

like image 27
Everyday Engineer Avatar answered Sep 24 '22 18:09

Everyday Engineer