Bloc: Using Rx.combineLatest2 for 2 different Blocs

Created on 1 Jun 2020  路  2Comments  路  Source: felangel/bloc

Hi

in my case I have 2 different Blocs and I want to combine them together like :
Rx.combineLatest2(positionBloc.state, disableBloc.state, (a, b) => null)
and says:
The argument type 'PositionState' can't be assigned to the parameter type 'Stream<dynamic>'
The argument type 'DisableState' can't be assigned to the parameter type 'Stream<dynamic>'

so what can I do here for combining ?
also is it possible to add CombineBlocs to existing widget in this awesome library ?

Thanks.

question

Most helpful comment

Hi @mohammadne 馃憢

The bloc itself is a Stream<State> so you should be combining the blocs and not their state.
Rx.combineLatest2(positionBloc, disableBloc, (a, b) => null)

Alternatively you could inject some bloc into some other bloc as showcased here.

All 2 comments

Hi @mohammadne 馃憢

The bloc itself is a Stream<State> so you should be combining the blocs and not their state.
Rx.combineLatest2(positionBloc, disableBloc, (a, b) => null)

Alternatively you could inject some bloc into some other bloc as showcased here.

Thanks @RollyPeres for taking the time to answer! 馃檹

@mohammadne closing this for now but feel free to comment with additional questions and I'm happy to continue the conversation 馃憤

Was this page helpful?
0 / 5 - 0 ratings