Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add asStateFlow to the StateFlow variables in ViewModel class #535

Closed
ryan-conway opened this issue Oct 6, 2023 · 1 comment · Fixed by #545
Closed

Add asStateFlow to the StateFlow variables in ViewModel class #535

ryan-conway opened this issue Oct 6, 2023 · 1 comment · Fixed by #545

Comments

@ryan-conway
Copy link
Collaborator

ryan-conway commented Oct 6, 2023

Original RFC

Why

Currently we can emit values to our StateFlow variables by casting them to MutableStateFlow. We should update our StateFlow declarations to make them read-only

Solution

  • Update our StateFlow declarations as follows:
    private val _uiModels = MutableStateFlow<List<UiModel>>(emptyList())
    val uiModels = _uiModels.asStateFlow()
    
  • Apply updates to template-compose and sample-compose ViewModels

Who Benefits?

Developers

@luongvo
Copy link
Member

luongvo commented Oct 20, 2023

@kaungkhantsoe please update your ticket status. Currently, it's in Icebox.

@ryan-conway ryan-conway modified the milestones: 3.26.0, 3.25.0 Oct 20, 2023
ryan-conway added a commit that referenced this issue Oct 23, 2023
…viewmodel

[#535] Add asStateFlow to the StateFlow variables in ViewModel class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants