Skip to content
New issue

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

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

Already on GitHub? # to your account

StreamViewModel get data based on a parameter? #7

Closed
thedigitalpro opened this issue Apr 26, 2020 · 2 comments
Closed

StreamViewModel get data based on a parameter? #7

thedigitalpro opened this issue Apr 26, 2020 · 2 comments

Comments

@thedigitalpro
Copy link

thedigitalpro commented Apr 26, 2020

Hi. Absolutely loving the latest update but have a question regarding StreamViewModel.

Please could you advise how I can listen to a stream based on a provided parameter? It appears the get stream is called before providing any opportunity to pass in a parameter. I have tried the constructor to no avail.

return ViewModelBuilder<EventViewModel>.reactive( disposeViewModel: false, viewModelBuilder: () => EventViewModel(_eventId), builder: (context, model, child) =>

@override Stream<List<EventCategory>> get stream => _database.eventsCategory(_eventId);

Thank you.

@FilledStacks
Copy link
Contributor

@thedigitalpro New version pushed. Try out 1.2.2, the subscription is now moved till after the construction so passing through the constructor should work. Thanks for letting me know.

@thedigitalpro
Copy link
Author

@thedigitalpro New version pushed. Try out 1.2.2, the subscription is now moved till after the construction so passing through the constructor should work. Thanks for letting me know.

Thank you so much Dane for such a quick response. This is fantastic and works a treat! Such a great solution you are coming up with here.

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

No branches or pull requests

2 participants