Hi, I'm looking into source code of `Checkbox` and...
# compose
e
Hi, I'm looking into source code of
Checkbox
and
FilterChip
default colors. So for
Checkbox
colors are implemented as
Copy code
object CheckboxDefaults {

	fun colors(..) : CheckboxColors {
		return remember (...) { DefaultCheckboxColors(...) }
	}
}
and for
FilterChip
default colors are implemented as
Copy code
object ChipDefaults {
	fun filterChipColors(...) : SelectableChipColors {
		return DefaultSelectableChipColors(...)
	}
}
My question is: Why was
remember
used in one of the cases and not in the other one?
z
Im just guessing here, but looking at their source code they arent all that different from each other.. so potentially just personal preference by the developers who wrote each?
l
Yep, no particular reason, these should ideally be unified in the future but it isn't a big deal either way - it just ended up this way because of the components being developed over different time periods
It's hard to quantify the cost of remembering a simple object like this compared to allocating a new object, it depends on things like the number of recompositions which can vary depending on usage