orangy
imageResource (composable with remember) vs imageFromResource (just creates ImageBitmap). In a composable context it’s easy to use the wrong one and cause excessive bitmap creations. Consider renaming one of them to be not so similar and making it more obvious from the name when to use which.jim
01/08/2021, 2:28 PMimageResource should be renamed to rememberImageResource to conform to our internal API guidelines; can you file a bug please (https://github.com/JetBrains/compose-jb/issues) and post a link to it here in slack?orangy
jim
01/08/2021, 3:01 PMremember prefix is not correct here.jim
01/08/2021, 3:08 PMimageFromResource doesn't do any caching, and they should both behave more similarly. Although it seems like we should provide apps with a way to load images from outside of a Composable call tree. Perhaps cachedImageResource for the variant that does remember caching? I'll bring it up with API council. Thanks for flagging.orangy
imageFromResource is not composable, so it can be used for manual caching, e.g. an object with static resources. It looks like the semantic is fine, it’s just that names are confusingorangy
loadImageFromResource so it highlights it does the job every time