{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/rxdart/issues/192","repository_url":"https://api.github.com/repos/ReactiveX/rxdart","labels_url":"https://api.github.com/repos/ReactiveX/rxdart/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/rxdart/issues/192/comments","events_url":"https://api.github.com/repos/ReactiveX/rxdart/issues/192/events","html_url":"https://github.com/ReactiveX/rxdart/issues/192","id":368824888,"node_id":"MDU6SXNzdWUzNjg4MjQ4ODg=","number":192,"title":"BehaviorSubject Question","user":{"login":"bagintz","id":5341290,"node_id":"MDQ6VXNlcjUzNDEyOTA=","avatar_url":"https://avatars1.githubusercontent.com/u/5341290?v=4","gravatar_id":"","url":"https://api.github.com/users/bagintz","html_url":"https://github.com/bagintz","followers_url":"https://api.github.com/users/bagintz/followers","following_url":"https://api.github.com/users/bagintz/following{/other_user}","gists_url":"https://api.github.com/users/bagintz/gists{/gist_id}","starred_url":"https://api.github.com/users/bagintz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagintz/subscriptions","organizations_url":"https://api.github.com/users/bagintz/orgs","repos_url":"https://api.github.com/users/bagintz/repos","events_url":"https://api.github.com/users/bagintz/events{/privacy}","received_events_url":"https://api.github.com/users/bagintz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-10-10T19:49:46Z","updated_at":"2018-10-16T20:15:34Z","closed_at":"2018-10-12T15:24:25Z","author_association":"NONE","body":"I am not sure if I am thinking of this right, but I am using rxdart with BLoC's in flutter and I seem to be hitting a roadblock.\r\n\r\nEverything works great when thinking in terms of everything being streams inside widgets, etc.  Let's use the itemCount example from  Filip Hracek (https://medium.com/flutter-io/build-reactive-mobile-apps-in-flutter-companion-article-13950959e381).  Everything in there looks good.  But....\r\n\r\nWhat if, instead of getting the itemCount in a widget to display to the UI I wanted to have it available to put in an \"share intent\", so I can send a message that says \"I have X number of items in my cart\"\r\n\r\nIt seems overkill to have to create a BehaviorSubject.stream.listen(.....) and then to cancel that after you get the single number.  \r\n\r\nIs there no way, from a stream (since BLoC's suggest you only expose Streams and Sinks) to just get the last value from that stream cleanly? \r\n\r\nIf I am asking the wrong thing or in the wrong place, please let me know!"},"comment":{"url":"https://api.github.com/repos/ReactiveX/rxdart/issues/comments/430384537","html_url":"https://github.com/ReactiveX/rxdart/issues/192#issuecomment-430384537","issue_url":"https://api.github.com/repos/ReactiveX/rxdart/issues/192","id":430384537,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDM4NDUzNw==","user":{"login":"bagintz","id":5341290,"node_id":"MDQ6VXNlcjUzNDEyOTA=","avatar_url":"https://avatars1.githubusercontent.com/u/5341290?v=4","gravatar_id":"","url":"https://api.github.com/users/bagintz","html_url":"https://github.com/bagintz","followers_url":"https://api.github.com/users/bagintz/followers","following_url":"https://api.github.com/users/bagintz/following{/other_user}","gists_url":"https://api.github.com/users/bagintz/gists{/gist_id}","starred_url":"https://api.github.com/users/bagintz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagintz/subscriptions","organizations_url":"https://api.github.com/users/bagintz/orgs","repos_url":"https://api.github.com/users/bagintz/repos","events_url":"https://api.github.com/users/bagintz/events{/privacy}","received_events_url":"https://api.github.com/users/bagintz/received_events","type":"User","site_admin":false},"created_at":"2018-10-16T20:15:34Z","updated_at":"2018-10-16T20:15:34Z","author_association":"NONE","body":"@brianegan \r\nWhat I am doing currently, using 0.19.0 in my BLoCs, is:\r\n\r\n```\r\n....\r\n//Output\r\nfinal _loggedInUser = BehaviorSubject<UserProfile>();\r\nObservable<UserProfile> get loggedInUserStream => _loggedInUser.stream.distinct();\r\nValueObservable<UserProfile> get loggedInUser => _loggedInUser.stream;\r\n\r\n//Input\r\nfinal _loginUserController = BehaviorSubject<UserProfile>();\r\nSink<UserProfile> get loginUser => _loginUserController.sink;\r\n....\r\n```\r\n\r\nSo I am using the Bloc.loggedInUser.value as the \"last value\" from the stream, but since the ValueObservable does not allow for distinct, I have to do it with 2 getters.  \r\n\r\nIf the ValueObservable was transformable, I could just use loggedInUserStream.value in my code.\r\n\r\nAgain, I might be missing something.  Ultimately this works fine, it is just one more variable to manage for each stateful object I want to track."}}
{"actor":{"display_login":"bagintz"}}