android / android/nowinandroid

[question] why not create helper extension functions?

Open
#1,927 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
21.8k
Forks
4.6k
Avg merge
19h 20m
Merged PRs (30d)
2

Description

Foe example in ViewModels there are a lot of very similar code
```
}.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(5_000),
initialValue = SearchResultUiState.Loading,
)
```

in tests there are `backgroundScope.launch(UnconfinedTestDispatcher()) { viewModel.searchResultUiState.collect() }`

so why not have extension functions to simplify it?

Contributor guide

Open the contributing guide

Research direction

Review the repeated stateIn blocks in the ViewModels and the backgroundScope.launch(UnconfinedTestDispatcher()) collectors in tests. First determine whether the proposal has a defined API and scope; done would require an agreed design and documented examples or tests showing the resulting helper functions are appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.