Has anyone used Kotlin context receivers in an Android project?
What are the exact use cases you have solved in real Android problems?
s
stantronic
07/03/2024, 5:43 PM
I've used them sparingly, mainly to cut-down on boilerplate. I have a fragment where there are about a twenty different state-flows to observe and update some traditional Android views, and this was a massive function in the fragment, so i extracted the function to a different file with the viewmodel and fragment as receivers
b
Bilagi
07/03/2024, 5:51 PM
Thanks, Steven!
Do you have any example code snippets that could help me better understand?
c
Chrimaeon
07/04/2024, 11:49 AM
I would not use context receivers now - there will be a different concept, context parameters
You can find a talk about it from KotlinConf over here
https://kotlinconf.com/talks/621119/
b
Bilagi
07/11/2024, 2:31 PM
So if I understood correctly they dropped context receivers right ?