Error: Method not found: 'Observable.combineLatest2'

Issue

Compiler message:
lib/app/home/entries/entries_bloc.dart:17:62: Error: Method not found: ‘Observable.combineLatest2’.
Stream> get _allEntriesStream => Observable.combineLatest2(
^^^^^^^^^^^^^^

Stream<List<EntryJob>> get _allEntriesStream => Observable.combineLatest2(
   database.entriesStream(),
   database.jobsStream(),
   _entriesJobsCombiner,
 );

Solution

Change this:

Observable.combineLatest2(
   database.entriesStream(),
   database.jobsStream(),
   _entriesJobsCombiner,
 );

into this:

Rx.combineLatest2(
   database.entriesStream(),
   database.jobsStream(),
   _entriesJobsCombiner,
 );

The Rx utility class contains the method combineLatest2

https://pub.dev/documentation/rxdart/latest/rx/Rx-class.html

Answered By – Peter Haddad

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.