google / google/accompanist

[DrawablePainter] Use mutableStateOf(Unit, neverEqualPolicy()) / mutableIntStateOf to invalidate

Open
#1,822 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
7.8k
Forks
683
PR merge metrics
No merged PRs in 30d

Description

https://github.com/google/accompanist/blob/fda7f06a24a42b0b1afa75591e768d82d2941984/drawablepainter/src/main/java/com/google/accompanist/drawablepainter/DrawablePainter.kt#L59
Could be replaced with `mutableStateOf(Unit, neverEqualPolicy())`.
Though according to [this](https://github.com/androidx/androidx/blob/3b824e8b3b8a52d5925cd1c69ae97bf9efc50709/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/graphics/vector/VectorPainter.kt#L225) there is an internal [bug](https://issuetracker.google.com/291647821) which I can't tell if it's already addressed.
If not, `mutableIntStateOf` can be used instead.

https://github.com/google/accompanist/blob/fda7f06a24a42b0b1afa75591e768d82d2941984/drawablepainter/src/main/java/com/google/accompanist/drawablepainter/DrawablePainter.kt#L60
Can also be replaced with `mutableLongStateOf` but I'm not sure if it's worth it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.